\input{preamble}

% OK, start here.
%
\begin{document}

\title{Differential Graded Sheaves}


\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents

\section{Introduction}
\label{section-introduction}

\noindent
This chapter is a continuation of the discussion started in
Differential Graded Algebra, Section \ref{dga-section-introduction}.
A survey paper is \cite{Keller-survey}.




\section{Conventions}
\label{section-conventions}

\noindent
In this chapter we hold on to the convention that {\it ring} means
commutative ring with $1$. If $R$ is a ring, then an {\it $R$-algebra $A$}
will be an $R$-module $A$ endowed with an $R$-bilinear map $A \times A \to A$
(multiplication) such that multiplication is associative and has an
identity.
In other words, these are unital associative $R$-algebras
such that the structure map $R \to A$ maps into the center of $A$.








\section{Sheaves of graded algebras}
\label{section-ga}

\noindent
Please skip this section.

\begin{definition}
\label{definition-ga}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. A
{\it sheaf of graded $\mathcal{O}$-algebras}
or a {\it sheaf of graded algebras} on $(\mathcal{C}, \mathcal{O})$
is given by a family $\mathcal{A}^n$ indexed by $n \in \mathbf{Z}$
of $\mathcal{O}$-modules endowed with $\mathcal{O}$-bilinear maps
$$
\mathcal{A}^n \times \mathcal{A}^m \to \mathcal{A}^{n + m},\quad
(a, b) \longmapsto ab
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication is associative, and
\item there is a global section $1$ of $\mathcal{A}^0$
which is a two-sided identity for multiplication.
\end{enumerate}
We often denote such a structure $\mathcal{A}$.
A {\it homomorphism of graded $\mathcal{O}$-algebras}
$f : \mathcal{A} \to \mathcal{B}$ is a family of maps
$f^n : \mathcal{A}^n \to \mathcal{B}^n$
of $\mathcal{O}$-modules compatible with the multiplication maps.
\end{definition}

\noindent
Given a graded $\mathcal{O}$-algebra $\mathcal{A}$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{A}(U) =
\Gamma(U, \mathcal{A}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{A}^n(U)
$$
This is a graded $\mathcal{O}(U)$-algebra.

\begin{remark}
\label{remark-functoriality-ga}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. We have
\begin{enumerate}
\item Let $\mathcal{A}$ be a graded $\mathcal{O}_\mathcal{C}$-algebra.
The multiplication maps of $\mathcal{A}$ induce multiplication maps
$f_*\mathcal{A}^n \times f_*\mathcal{A}^m \to f_*\mathcal{A}^{n + m}$
and via $f^\sharp$ we may view these as $\mathcal{O}_\mathcal{D}$-bilinear
maps. We will denote $f_*\mathcal{A}$ the graded
$\mathcal{O}_\mathcal{D}$-algebra we so obtain.
\item Let $\mathcal{B}$ be a graded
$\mathcal{O}_\mathcal{D}$-algebra. 
The multiplication maps of $\mathcal{B}$ induce multiplication maps
$f^*\mathcal{B}^n \times f^*\mathcal{B}^m \to f^*\mathcal{B}^{n + m}$
and using $f^\sharp$ we may view these as $\mathcal{O}_\mathcal{C}$-bilinear
maps. We will denote $f^*\mathcal{B}$
the graded $\mathcal{O}_\mathcal{C}$-algebra we so obtain.
\item The set of homomorphisms $f^*\mathcal{B} \to \mathcal{A}$
of graded $\mathcal{O}_\mathcal{C}$-algebras is in
$1$-to-$1$ correspondence with the set of homomorphisms
$\mathcal{B} \to f_*\mathcal{A}$ of graded $\mathcal{O}_\mathcal{C}$-algebras.
\end{enumerate}
Part (3) follows immediately from the usual adjunction between $f^*$ and $f_*$
on sheaves of modules.
\end{remark}




\section{Sheaves of graded modules}
\label{section-graded-modules}

\noindent
Please skip this section.

\begin{definition}
\label{definition-gm}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of graded algebras
on $(\mathcal{C}, \mathcal{O})$.
A (right) {\it graded $\mathcal{A}$-module} or (right)
{\it graded module} over $\mathcal{A}$
is given by a family $\mathcal{M}^n$ indexed by $n \in \mathbf{Z}$
of $\mathcal{O}$-modules endowed with
$\mathcal{O}$-bilinear maps
$$
\mathcal{M}^n \times \mathcal{A}^m \to \mathcal{M}^{n + m},\quad
(x, a) \longmapsto xa
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication satisfies $(xa)a' = x(aa')$,
\item the identity section $1$ of $\mathcal{A}^0$
acts as the identity on $\mathcal{M}^n$ for all $n$.
\end{enumerate}
We often say ``let $\mathcal{M}$ be a graded $\mathcal{A}$-module''
to indicate this situation.
A {\it homomorphism of graded $\mathcal{A}$-modules}
$f : \mathcal{M} \to \mathcal{N}$ is a family of maps
$f^n : \mathcal{M}^n \to \mathcal{N}^n$
of $\mathcal{O}$-modules compatible with the multiplication maps.
The category of (right) graded $\mathcal{A}$-modules
is denoted $\textit{Mod}(\mathcal{A})$.
\end{definition}

\noindent
We can define {\it left graded modules} in exactly the same manner
but our default in the chapter will be right modules.

\medskip\noindent
Given a graded $\mathcal{A}$-module $\mathcal{M}$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{M}(U) =
\Gamma(U, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{M}^n(U)
$$
This is a (right) graded $\mathcal{A}(U)$-module.

\begin{lemma}
\label{lemma-gm-abelian}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a graded $\mathcal{O}$-algebra.
The category $\textit{Mod}(\mathcal{A})$ is an abelian category
with the following properties
\begin{enumerate}
\item $\textit{Mod}(\mathcal{A})$ has arbitrary direct sums,
\item $\textit{Mod}(\mathcal{A})$ has arbitrary colimits,
\item filtered colimit in $\textit{Mod}(\mathcal{A})$ are exact,
\item $\textit{Mod}(\mathcal{A})$ has arbitrary products,
\item $\textit{Mod}(\mathcal{A})$ has arbitrary limits.
\end{enumerate}
The functor
$$
\textit{Mod}(\mathcal{A}) \longrightarrow \textit{Mod}(\mathcal{O}),\quad
\mathcal{M} \longmapsto \mathcal{M}^n
$$
sending a graded $\mathcal{A}$-module to its $n$th term commutes
with all limits and colimits.
\end{lemma}

\noindent
The lemma says that we may take limits and colimits termwise. It
also says (or implies if you like) that the forgetful functor
$$
\textit{Mod}(\mathcal{A})
\longrightarrow
\text{graded }\mathcal{O}\text{-modules}
$$
commutes with all limits and colimits.

\begin{proof}
Let us denote
$\text{gr}^n : \textit{Mod}(\mathcal{A}) \to \textit{Mod}(\mathcal{O})$
the functor in the statement of the lemma.
Consider a homomorphism $f : \mathcal{M} \to \mathcal{N}$
of graded $\mathcal{A}$-modules. The kernel
and cokernel of $f$ as maps of graded $\mathcal{O}$-modules
are additionally endowed with multiplication maps as in
Definition \ref{definition-gm}. Hence these are also
the kernel and cokernel in $\textit{Mod}(\mathcal{A})$.
Thus $\textit{Mod}(\mathcal{A})$ is an abelian category
and taking kernels and cokernels commutes with $\text{gr}^n$.

\medskip\noindent
To prove the existence of limits and colimits it is sufficient
to prove the existence of products and direct sums, see
Categories, Lemmas \ref{categories-lemma-limits-products-equalizers} and
\ref{categories-lemma-colimits-coproducts-coequalizers}.
The same lemmas show that
proving the commutation of limits and colimits with $\text{gr}^n$
follows if $\text{gr}^n$ commutes with direct sums and products.

\medskip\noindent
Let $\mathcal{M}_t$, $t \in T$ be a set of graded $\mathcal{A}$-modules.
Then we can consider the graded $\mathcal{A}$-module whose degree $n$
term is $\bigoplus_{t \in T} \mathcal{M}_t^n$ (with obvious multiplication
maps). The reader easily verifies that this is a direct sum in
$\textit{Mod}(\mathcal{A})$. Similarly for products.

\medskip\noindent
Observe that $\text{gr}^n$ is an exact functor for all $n$ and that
a complex $\mathcal{M}_1 \to \mathcal{M}_2 \to \mathcal{M}_3$
of $\textit{Mod}(\mathcal{A})$ is exact if and only if
$\text{gr}^n\mathcal{M}_1 \to \text{gr}^n\mathcal{M}_2 \to
\text{gr}^n\mathcal{M}_3$ is exact in $\textit{Mod}(\mathcal{O})$
for all $n$. Hence we conclude that (3) holds as filtered
colimits are exact in $\textit{Mod}(\mathcal{O})$;
it is a Grothendieck abelian category, see
Cohomology on Sites, Section \ref{sites-cohomology-section-unbounded}.
\end{proof}






\section{The graded category of sheaves of graded modules}
\label{section-gm-gr-cat}

\noindent
Please skip this section. This section is the analogue of
Differential Graded Algebra, Example \ref{dga-example-gm-gr-cat}.
For our conventions on graded categories, please see
Differential Graded Algebra, Section \ref{dga-section-graded}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of graded algebras
on $(\mathcal{C}, \mathcal{O})$. We will construct
a graded category $\textit{Mod}^{gr}(\mathcal{A})$ over
$R = \Gamma(\mathcal{C}, \mathcal{O})$
whose associated category $(\textit{Mod}^{gr}(\mathcal{A}))^0$
is the category of graded $\mathcal{A}$-modules. As objects
of $\textit{Mod}^{gr}(\mathcal{A})$ we take right graded
$\mathcal{A}$-modules (see
Section \ref{section-graded-modules}). Given graded
$\mathcal{A}$-modules $\mathcal{L}$ and $\mathcal{M}$ we set
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(\mathcal{L}, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \Hom^n(\mathcal{L}, \mathcal{M})
$$
where
$\Hom^n(\mathcal{L}, \mathcal{M})$
is the set of right $\mathcal{A}$-module maps
$f : \mathcal{L} \to \mathcal{M}$ which
are homogeneous of degree $n$. More precisely, $f$ is given
by a family of maps $f : \mathcal{L}^i \to \mathcal{M}^{i + n}$
for $i \in \mathbf{Z}$ compatible with the multiplication
maps. In terms of components, we have that
$$
\Hom^n(\mathcal{L}, \mathcal{M})
\subset
\prod\nolimits_{p + q = n}
\Hom_\mathcal{O}(\mathcal{L}^{-q}, \mathcal{M}^p)
$$
(observe reversal of indices) is the subset consisting of those
$f = (f_{p, q})$ such that
$$
f_{p, q}(m a) = f_{p - i, q + i}(m)a
$$
for local sections $a$ of $\mathcal{A}^i$ and
$m$ of $\mathcal{L}^{-q - i}$. For graded $\mathcal{A}$-modules
$\mathcal{K}$, $\mathcal{L}$, $\mathcal{M}$
we define composition in $\textit{Mod}^{gr}(\mathcal{A})$ via
the maps
$$
\Hom^m(\mathcal{L}, \mathcal{M}) \times
\Hom^n(\mathcal{K}, \mathcal{L}) \longrightarrow
\Hom^{n + m}(\mathcal{K}, \mathcal{M})
$$
by simple composition of right
$\mathcal{A}$-module maps: $(g, f) \mapsto g \circ f$.





\section{Tensor product for sheaves of graded modules}
\label{section-tensor-product}

\noindent
Please skip this section. This section is the analogue of part of
Differential Graded Algebra, Section \ref{dga-section-tensor-product}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
be a sheaf of graded algebras on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{M}$ be a right graded $\mathcal{A}$-module
and let $\mathcal{N}$ be a left graded $\mathcal{A}$-module.
Then we define the {\it tensor product}
$\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$
to be the graded $\mathcal{O}$-module whose degree $n$ term is
$$
(\mathcal{M} \otimes_\mathcal{A} \mathcal{N})^n =
\Coker\left(
\bigoplus\nolimits_{r + s + t = n} \mathcal{M}^r \otimes_\mathcal{O}
\mathcal{A}^s \otimes_\mathcal{O} \mathcal{N}^t
\longrightarrow
\bigoplus\nolimits_{p + q = n} \mathcal{M}^p \otimes_\mathcal{O} \mathcal{N}^q
\right)
$$
where the map sends the local section $x \otimes a \otimes y$
of $\mathcal{M}^r \otimes_\mathcal{O} \mathcal{A}^s
\otimes_\mathcal{O} \mathcal{N}^t$ to
$xa \otimes y - x \otimes ay$.
With this definition we have that
$(\mathcal{M} \otimes_\mathcal{A} \mathcal{N})^n$
is the sheafification of the presheaf
$U \mapsto (\mathcal{M}(U) \otimes_{\mathcal{A}(U)} \mathcal{N}(U))^n$
where the tensor product of graded modules is as defined in
Differential Graded Algebra, Section \ref{dga-section-tensor-product}.

\medskip\noindent
If we fix the left graded $\mathcal{A}$-module $\mathcal{N}$
we obtain a functor
$$
- \otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}(\mathcal{A})
\longrightarrow
\text{Gr}(\textit{Mod}(\mathcal{O})) =
\text{graded }\mathcal{O}\text{-modules}
$$
For the notation $\text{Gr}(-)$ please see
Homology, Definition \ref{homology-definition-graded}.
The graded category of graded $\mathcal{O}$-modules is denoted
$\text{Gr}^{gr}(\textit{Mod}(\mathcal{O}))$, see
Differential Graded Algebra, Example
\ref{dga-example-graded-category-graded-objects}.
The functor above can be upgraded to a functor of graded categories
$$
- \otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}^{gr}(\mathcal{A})
\longrightarrow
\text{Gr}^{gr}(\textit{Mod}(\mathcal{O}))
$$
by sending homomorphisms of degree $n$ from $\mathcal{M} \to \mathcal{M}'$
to the induced map of degree $n$ from
$\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ to
$\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}$.






\section{Internal hom for sheaves of graded modules}
\label{section-internal-hom-graded}

\noindent
We urge the reader to skip this section.

\medskip\noindent
We are going to need the sheafified version of the construction
in Section \ref{section-gm-gr-cat}.
Let $(\mathcal{C}, \mathcal{O})$, $\mathcal{A}$,
$\mathcal{M}$, $\mathcal{L}$ be as in Section \ref{section-gm-gr-cat}.
Then we define
$$
\SheafHom^{gr}_\mathcal{A}(\mathcal{M}, \mathcal{L})
$$
as the graded $\mathcal{O}$-module whose degree $n$ term
$$
\SheafHom^n_\mathcal{A}(\mathcal{M}, \mathcal{L})
\subset
\prod\nolimits_{p + q = n}
\SheafHom_\mathcal{O}(\mathcal{L}^{-q}, \mathcal{M}^p)
$$
is the subsheaf consisting of those local sections $f = (f_{p, q})$ such that
$$
f_{p, q}(m a) = f_{p - i, q + i}(m)a
$$
for local sections $a$ of $\mathcal{A}^i$ and
$m$ of $\mathcal{L}^{-q - i}$. As in Section \ref{section-gm-gr-cat}
there is a composition map
$$
\SheafHom^{gr}_\mathcal{A}(\mathcal{L}, \mathcal{M}) \otimes_\mathcal{O}
\SheafHom^{gr}_\mathcal{A}(\mathcal{K}, \mathcal{L})
\longrightarrow
\SheafHom^{gr}_\mathcal{A}(\mathcal{K}, \mathcal{M})
$$
where the left hand side is the tensor product of graded $\mathcal{O}$-modules
defined in Section \ref{section-tensor-product}.
This map is given by the composition map
$$
\SheafHom^m_\mathcal{A}(\mathcal{L}, \mathcal{M}) \otimes_\mathcal{O}
\SheafHom^n_\mathcal{A}(\mathcal{K}, \mathcal{L}) \longrightarrow
\SheafHom^{n + m}_\mathcal{A}(\mathcal{K}, \mathcal{M})
$$
defined by simple composition (locally).

\medskip\noindent
With these definitions we have
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(\mathcal{L}, \mathcal{M}) =
\Gamma(\mathcal{C}, \SheafHom^{gr}_\mathcal{A}(\mathcal{L}, \mathcal{M}))
$$
as graded $R$-modules compatible with composition.







\section{Sheaves of graded bimodules and tensor-hom adjunction}
\label{section-graded-bimodules}

\noindent
Please skip this section.

\begin{definition}
\label{definition-bimodule}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of graded algebras on
$(\mathcal{C}, \mathcal{O})$. A
{\it graded $(\mathcal{A}, \mathcal{B})$-bimodule}
is given by a family $\mathcal{M}^n$ indexed by $n \in \mathbf{Z}$
of $\mathcal{O}$-modules endowed with $\mathcal{O}$-bilinear maps
$$
\mathcal{M}^n \times \mathcal{B}^m \to \mathcal{M}^{n + m},\quad
(x, b) \longmapsto xb
$$
and
$$
\mathcal{A}^n \times \mathcal{M}^m \to \mathcal{M}^{n + m},\quad
(a, x) \longmapsto ax
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication satisfies $a(a'x) = (aa')x$ and
$(xb)b' = x(bb')$,
\item $(ax)b = a(xb)$,
\item the identity section $1$ of $\mathcal{A}^0$ acts as the
identity by multiplication, and
\item the identity section $1$ of
$\mathcal{B}^0$ acts as the identity by multiplication.
\end{enumerate}
We often denote such a structure $\mathcal{M}$.
A {\it homomorphism of graded $(\mathcal{A}, \mathcal{B})$-bimodules}
$f : \mathcal{M} \to \mathcal{N}$ is a family of maps
$f^n : \mathcal{M}^n \to \mathcal{N}^n$
of $\mathcal{O}$-modules compatible with the multiplication maps.
\end{definition}

\noindent
Given a graded $(\mathcal{A}, \mathcal{B})$-bimodule $\mathcal{M}$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{M}(U) =
\Gamma(U, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{M}^n(U)
$$
This is a graded $(\mathcal{A}(U), \mathcal{B}(U))$-bimodule.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$ be a right
graded $\mathcal{A}$-module and let $\mathcal{N}$ be a
graded $(\mathcal{A}, \mathcal{B})$-bimodule. In this case the
graded tensor product defined in Section \ref{section-tensor-product}
$$
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}
$$
is a right graded $\mathcal{B}$-module with obvious multiplication maps.
This construction defines a functor and a functor of graded categories
$$
\otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}(\mathcal{A})
\longrightarrow
\textit{Mod}(\mathcal{B})
\quad\text{and}\quad
\otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}^{gr}(\mathcal{A})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{B})
$$
by sending homomorphisms of degree $n$ from $\mathcal{M} \to \mathcal{M}'$
to the induced map of degree $n$ from
$\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ to
$\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}$.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{N}$ be a
graded $(\mathcal{A}, \mathcal{B})$-bimodule. Let 
$\mathcal{L}$ be a right graded $\mathcal{B}$-module.
In this case the graded internal hom
defined in Section \ref{section-internal-hom-graded}
$$
\SheafHom_\mathcal{B}^{gr}(\mathcal{N}, \mathcal{L})
$$
is a right graded $\mathcal{A}$-module with
multiplication maps\footnote{Our conventions are here
that this does not involve any signs.}
$$
\SheafHom^n_\mathcal{B}(\mathcal{N}, \mathcal{L})
\times \mathcal{A}^m
\longrightarrow
\SheafHom^{n + m}_\mathcal{B}(\mathcal{N}, \mathcal{L})
$$
sending a section $f = (f_{p,q})$ of
$\SheafHom^n_\mathcal{B}(\mathcal{N}, \mathcal{L})$ over $U$
and a section $a$ of $\mathcal{A}^m$ over $U$ to the section
$f a$ if $\SheafHom^{n + m}_\mathcal{B}(\mathcal{N}, \mathcal{L})$ over $U$
defined as the family of maps
$$
\mathcal{N}^{-q - m}|_U \xrightarrow{a \cdot -}
\mathcal{N}^{-q}|_U \xrightarrow{f_{p, q}}
\mathcal{M}^p|_U
$$
We omit the verification that this is well defined. This construction
defines a functor and a functor of graded categories
$$
\SheafHom_\mathcal{B}^{gr}(\mathcal{N}, -) :
\textit{Mod}(\mathcal{B})
\longrightarrow
\textit{Mod}(\mathcal{A})
\quad\text{and}\quad
\SheafHom_\mathcal{B}^{gr}(\mathcal{N}, -) :
\textit{Mod}^{gr}(\mathcal{B})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A})
$$
by sending homomorphisms of degree $n$ from $\mathcal{L} \to \mathcal{L}'$
to the induced map of degree $n$ from
$\SheafHom_\mathcal{B}^{gr}(\mathcal{N}, \mathcal{L})$ to
$\SheafHom_\mathcal{B}^{gr}(\mathcal{N}, \mathcal{L}')$.

\begin{lemma}
\label{lemma-tensor-hom-adjunction-gr}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$ be a right
graded $\mathcal{A}$-module. Let $\mathcal{N}$ be a
graded $(\mathcal{A}, \mathcal{B})$-bimodule. Let $\mathcal{L}$
be a right graded $\mathcal{B}$-module. With conventions as above
we have
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{B})}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}, \mathcal{L}) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(
\mathcal{M}, \SheafHom_\mathcal{B}^{gr}(\mathcal{N}, \mathcal{L}))
$$
and
$$
\SheafHom_\mathcal{B}^{gr}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}, \mathcal{L}) =
\SheafHom_\mathcal{A}^{gr}(
\mathcal{M}, \SheafHom_\mathcal{B}^{gr}(\mathcal{N}, \mathcal{L}))
$$
functorially in $\mathcal{M}$, $\mathcal{N}$, $\mathcal{L}$.
\end{lemma}

\begin{proof}
Omitted. Hint: This follows by interpreting both sides as
$\mathcal{A}$-bilinear graded maps
$\psi : \mathcal{M} \times \mathcal{N} \to \mathcal{L}$
which are $\mathcal{B}$-linear on the right.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of graded algebras on
$(\mathcal{C}, \mathcal{O})$.
As a special case of the above, suppose we are given
a homomorphism $\varphi : \mathcal{A} \to \mathcal{B}$
of graded $\mathcal{O}$-algebras. Then we obtain a functor
and a functor of graded categories
$$
\otimes_{\mathcal{A}, \varphi} \mathcal{B} :
\textit{Mod}(\mathcal{A})
\longrightarrow
\textit{Mod}(\mathcal{B})
\quad\text{and}\quad
\otimes_{\mathcal{A}, \varphi} \mathcal{B} :
\textit{Mod}^{gr}(\mathcal{A})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{B})
$$
On the other hand, we have the restriction functors
$$
res_\varphi :
\textit{Mod}(\mathcal{B})
\longrightarrow
\textit{Mod}(\mathcal{A})
\quad\text{and}\quad
res_\varphi :
\textit{Mod}^{gr}(\mathcal{B})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A})
$$
We can use the lemma above to show these functors are adjoint to
each other (as usual with restriction and base change). Namely,
let us write ${}_\mathcal{A}\mathcal{B}_\mathcal{B}$ for
$\mathcal{B}$ viewed as a graded $(\mathcal{A}, \mathcal{B})$-bimodule.
Then for any right graded $\mathcal{B}$-module $\mathcal{L}$
we have
$$
\SheafHom_\mathcal{B}^{gr}({}_\mathcal{A}\mathcal{B}_\mathcal{B}, \mathcal{L})
= res_\varphi(\mathcal{L})
$$
as right graded $\mathcal{A}$-modules. Thus
Lemma \ref{lemma-tensor-hom-adjunction-gr}
tells us that we have a functorial isomorphism
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{B})}(
\mathcal{M} \otimes_{\mathcal{A}, \varphi} \mathcal{B}, \mathcal{L}) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(
\mathcal{M}, res_\varphi(\mathcal{L}))
$$
We usually drop the dependence on $\varphi$ in this formula if it
is clear from context. In the same manner we obtain
the equality
$$
\SheafHom^{gr}_\mathcal{B}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{B}, \mathcal{L}) =
\SheafHom_\mathcal{A}^{gr}(\mathcal{M}, \mathcal{L})
$$
of graded $\mathcal{O}$-modules.




\section{Pull and push for sheaves of graded modules}
\label{section-functoriality-graded}

\noindent
We advise the reader to skip this section.

\medskip\noindent
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
graded $\mathcal{O}_\mathcal{D}$-algebra.
Suppose we are given a map
$$
\varphi : f^{-1}\mathcal{B} \to \mathcal{A}
$$
of graded $f^{-1}\mathcal{O}_\mathcal{D}$-algebras.
By the adjunction of restriction and extension of scalars, this
is the same thing as a map $\varphi : f^*\mathcal{B} \to \mathcal{A}$
of graded $\mathcal{O}_\mathcal{C}$-algebras or equivalently
$\varphi$ can be viewed as a map
$$
\varphi : \mathcal{B} \to f_*\mathcal{A}
$$
of graded $\mathcal{O}_\mathcal{D}$-algebras.
See Remark \ref{remark-functoriality-ga}.

\medskip\noindent
Let us define a functor
$$
f_* :
\textit{Mod}(\mathcal{A})
\longrightarrow
\textit{Mod}(\mathcal{B})
$$
Given a graded $\mathcal{A}$-module $\mathcal{M}$ we define
$f_*\mathcal{M}$ to be the graded $\mathcal{B}$-module
whose degree $n$ term is $f_*\mathcal{M}^n$. As multiplication
we use
$$
f_*\mathcal{M}^n \times \mathcal{B}^m
\xrightarrow{(\text{id}, \varphi^m)}
f_*\mathcal{M}^n \times f_*\mathcal{A}^m
\xrightarrow{f_*\mu_{n, m}}
f_*\mathcal{M}^{n + m}
$$
where $\mu_{n, m} : \mathcal{M}^n \times \mathcal{A}^m
\to \mathcal{M}^{n + m}$ is the multiplication map for $\mathcal{M}$
over $\mathcal{A}$. This uses that $f_*$ commutes with products.
The construction is clearly functorial in
$\mathcal{M}$ and we obtain our functor.

\medskip\noindent
Let us define a functor
$$
f^* :
\textit{Mod}(\mathcal{B})
\longrightarrow
\textit{Mod}(\mathcal{A})
$$
We will define this functor as a composite of functors
$$
\textit{Mod}(\mathcal{B})
\xrightarrow{f^{-1}}
\textit{Mod}(f^{-1}\mathcal{B})
\xrightarrow{ - \otimes_{f^{-1}\mathcal{B}} \mathcal{A}}
\textit{Mod}(\mathcal{A})
$$
First, given a graded $\mathcal{B}$-module $\mathcal{N}$ we define
$f^{-1}\mathcal{N}$ to be the graded $f^{-1}\mathcal{B}$-module
whose degree $n$ term is $f^{-1}\mathcal{N}^n$. As multiplication
we use
$$
f^{-1}\nu_{n, m} :
f^{-1}\mathcal{N}^n \times f^{-1}\mathcal{B}^m
\longrightarrow
f^{-1}\mathcal{N}^{n + m}
$$
where $\nu_{n, m} : \mathcal{N}^n \times \mathcal{B}^m
\to \mathcal{N}^{n + m}$ is the multiplication map for $\mathcal{N}$
over $\mathcal{B}$. This uses that $f^{-1}$ commutes with products.
The construction is clearly functorial in
$\mathcal{N}$ and we obtain our functor $f^{-1}$.
Having said this, we can use the tensor
product discussion in Section \ref{section-graded-bimodules}
to define the functor
$$
- \otimes_{f^{-1}\mathcal{B}} \mathcal{A} :
\textit{Mod}(f^{-1}\mathcal{B})
\longrightarrow
\textit{Mod}(\mathcal{A})
$$
Finally, we set
$$
f^*\mathcal{N} =
f^{-1}\mathcal{N} \otimes_{f^{-1}\mathcal{B}, \varphi} \mathcal{A}
$$
as already foretold above.

\medskip\noindent
The functors $f_*$ and $f^*$ are readily enhanced to give
functors of graded categories
$$
f_* :
\textit{Mod}^{gr}(\mathcal{A})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{B})
\quad\text{and}\quad
f^* :
\textit{Mod}^{gr}(\mathcal{B})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A})
$$
which do the same thing on underlying objects and are defined
by functoriality of the constructions on homogenous morphisms
of degree $n$.

\begin{lemma}
\label{lemma-adjunction-push-pull-gr}
In the situation above we have
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{B})}(
\mathcal{N}, f_*\mathcal{M}) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(
f^*\mathcal{N}, \mathcal{M})
$$
\end{lemma}

\begin{proof}
Omitted. Hints: First prove that $f^{-1}$ and $f_*$ are adjoint
as functors between $\textit{Mod}(\mathcal{B})$ and
$\textit{Mod}(f^{-1}\mathcal{B})$ using the adjunction between
$f^{-1}$ and $f_*$ on sheaves of abelian groups.
Next, use the adjunction between base change and restriction
given in Section \ref{section-graded-bimodules}.
\end{proof}





\section{Localization and sheaves of graded modules}
\label{section-localize-graded}

\noindent
We advise the reader to skip this section.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $U \in \Ob(\mathcal{C})$ and denote
$$
j :
(\Sh(\mathcal{C}/U), \mathcal{O}_U)
\longrightarrow
(\Sh(\mathcal{C}), \mathcal{O})
$$
the corresponding localization morphism
(Modules on Sites, Section \ref{sites-modules-section-localize}).
Below we will use the following fact: for $\mathcal{O}_U$-modules
$\mathcal{M}_i$, $i = 1, 2$ and a $\mathcal{O}$-module $\mathcal{A}$
there is a canonical map
$$
j_! :
\Hom_{\mathcal{O}_U}(
\mathcal{M}_1 \otimes_{\mathcal{O}_U} \mathcal{A}|_U, \mathcal{M}_2)
\longrightarrow
\Hom_\mathcal{O}(
j_!\mathcal{M}_1 \otimes_\mathcal{O} \mathcal{A}, j_!\mathcal{M}_2)
$$
Namely, we have
$j_!(\mathcal{M}_1 \otimes_{\mathcal{O}_U} \mathcal{A}|_U) =
j_!\mathcal{M}_1 \otimes_\mathcal{O} \mathcal{A}$ by
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}.

\medskip\noindent
Let $\mathcal{A}$ be a graded $\mathcal{O}$-algebra.
We will denote $\mathcal{A}_U$ the restriction of $\mathcal{A}$
to $\mathcal{C}/U$, in other words, we have
$\mathcal{A}_U = j^*\mathcal{A} = j^{-1}\mathcal{A}$.
In Section \ref{section-functoriality-graded}
we have constructed adjoint functors
$$
j_* :
\textit{Mod}^{gr}(\mathcal{A}_U)
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A})
\quad\text{and}\quad
j^* :
\textit{Mod}^{gr}(\mathcal{A})
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A}_U)
$$
with $j^*$ left adjoint to $j_*$. We claim there is in addition an
exact functor
$$
j_! :
\textit{Mod}^{gr}(\mathcal{A}_U)
\longrightarrow
\textit{Mod}^{gr}(\mathcal{A})
$$
left adjoint to $j^*$. Namely, given a graded $\mathcal{A}_U$-module
$\mathcal{M}$ we define $j_!\mathcal{M}$ to be the graded $\mathcal{A}$-module
whose degree $n$ term is $j_!\mathcal{M}^n$. As multiplication map
we use
$$
j_!\mu_{n, m} :
j_!\mathcal{M}^n \times \mathcal{A}^m \to
j_!\mathcal{M}^{n + m}
$$
where $\mu_{m, n} : \mathcal{M}^n \times \mathcal{A}^m \to \mathcal{M}^{n + m}$
is the given multiplication map. Given a homogeneous map
$f : \mathcal{M} \to \mathcal{M}'$ of degree $n$ of graded
$\mathcal{A}_U$-modules, we obtain a homogeneous map
$j_!f : j_!\mathcal{M} \to j_!\mathcal{M}'$ of degree $n$.
Thus we obtain our functor.

\begin{lemma}
\label{lemma-extension-by-zero-graded}
In the situation above we have
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(
j_!\mathcal{M}, \mathcal{N}) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A}_U)}(
\mathcal{M}, j^*\mathcal{N})
$$
\end{lemma}

\begin{proof}
By the discussion in
Modules on Sites, Section \ref{sites-modules-section-localize}
the functors $j_!$ and $j^*$ on $\mathcal{O}$-modules are adjoint.
Thus if we only look at the $\mathcal{O}$-module structures
we know that
$$
\Hom_{\text{Gr}^{gr}(\textit{Mod}(\mathcal{O}))}(
j_!\mathcal{M}, \mathcal{N}) =
\Hom_{\text{Gr}^{gr}(\textit{Mod}(\mathcal{O}_U))}(
\mathcal{M}, j^*\mathcal{N})
$$
(Recall that $\text{Gr}^{gr}(\textit{Mod}(\mathcal{O}))$ denotes
the graded category of graded $\mathcal{O}$-modules.)
Then one has to check that these identifications map the
$\mathcal{A}$-module maps on the left hand side to the
$\mathcal{A}_U$-module maps on the right hand side.
To check this, given $\mathcal{O}_U$-linear maps
$f^n : \mathcal{M}^n \to j^*\mathcal{N}^{n + d}$
corresponding to $\mathcal{O}$-linear maps
$g^n : j_!\mathcal{M}^n \to \mathcal{N}^{n + d}$
it suffices to show that
$$
\xymatrix{
\mathcal{M}^n \otimes_{\mathcal{O}_U} \mathcal{A}_U^m
\ar[r]_{f^n \otimes 1} \ar[d] &
j^*\mathcal{N}^{n + d} \otimes_{\mathcal{O}_U} \mathcal{A}_U^m \ar[d] \\
\mathcal{M}^{n + m} \ar[r]^{f^{n + m}} &
j^*\mathcal{N}^{n + m + d}
}
$$
commutes if and only if
$$
\xymatrix{
j_!\mathcal{M}^n \otimes_\mathcal{O} \mathcal{A}^m
\ar[r]_{g^n \otimes 1} \ar[d] &
\mathcal{N}^{n + d} \otimes_\mathcal{O} \mathcal{A}_U^m \ar[d] \\
j_!\mathcal{M}^{n + m} \ar[r]^{g^{n + m}} &
\mathcal{N}^{n + m + d}
}
$$
commutes. However, we know that
\begin{align*}
\Hom_{\mathcal{O}_U}(\mathcal{M}^n \otimes_{\mathcal{O}_U} \mathcal{A}_U^m,
j^*\mathcal{N}^{n + d + m})
& =
\Hom_\mathcal{O}(j_!(\mathcal{M}^n \otimes_{\mathcal{O}_U} \mathcal{A}_U^m),
\mathcal{N}^{n + d + m}) \\
& =
\Hom_\mathcal{O}(j_!\mathcal{M}^n \otimes_\mathcal{O} \mathcal{A}^m,
\mathcal{N}^{n + d + m})
\end{align*}
by the already used
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}.
We omit the verification that shows that the obstruction to the
commutativity of the first diagram in the first group maps
to the obstruction to the commutativity of the second diagram
in the last group.
\end{proof}

\begin{lemma}
\label{lemma-tensor-with-extension-by-zero}
In the situation above, let $\mathcal{M}$ be a right graded
$\mathcal{A}_U$-module and let $\mathcal{N}$ be a left graded
$\mathcal{A}$-module. Then
$$
j_!\mathcal{M} \otimes_\mathcal{A} \mathcal{N} =
j_!(\mathcal{M} \otimes_{\mathcal{A}_U} \mathcal{N}|_U)
$$
as graded $\mathcal{O}$-modules functorially in $\mathcal{M}$
and $\mathcal{N}$.
\end{lemma}

\begin{proof}
Recall that the degree $n$ component of
$j_!\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ is the cokernel of
the canonical map
$$
\bigoplus\nolimits_{r + s + t = n}
j_!\mathcal{M}^r \otimes_\mathcal{O}
\mathcal{A}^s \otimes_\mathcal{O}
\mathcal{N}^t
\longrightarrow
\bigoplus\nolimits_{p + q = n}
j_!\mathcal{M}^p \otimes_\mathcal{O} \mathcal{N}^q
$$
See Section \ref{section-tensor-product}.
By Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}
this is the same thing as the cokernel of
$$
\bigoplus\nolimits_{r + s + t = n}
j_!(\mathcal{M}^r \otimes_{\mathcal{O}_U}
\mathcal{A}^s|_U \otimes_{\mathcal{O}_U}
\mathcal{N}^t|_U)
\longrightarrow
\bigoplus\nolimits_{p + q = n}
j_!(\mathcal{M}^p \otimes_{\mathcal{O}_U} \mathcal{N}^q|_U)
$$
and we win. An alternative proof would be to redo the Yoneda
argument given in the proof of the lemma cited above.
\end{proof}








\section{Shift functors on sheaves of graded modules}
\label{section-shift}

\noindent
We urge the reader to skip this section. It turns out that sheaves
of graded modules over a graded algebra are an example of the phenomenon
discussed in
Differential Graded Algebra, Remark \ref{dga-remark-graded-shift-functors}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{M}$ be a graded $\mathcal{A}$-module. Let $k \in \mathbf{Z}$.
We define the {\it $k$th shift of} $\mathcal{M}$, denoted $\mathcal{M}[k]$,
to be the graded $\mathcal{A}$-module whose $n$th part is given by
$$
(\mathcal{M}[k])^n = \mathcal{M}^{n + k}
$$
is the $(n + k)$th part of $\mathcal{M}$. As multiplication maps
$$
(\mathcal{M}[k])^n \times \mathcal{A}^m
\longrightarrow
(\mathcal{M}[k])^{n + m}
$$
we simply use the multiplication maps
$$
\mathcal{M}^{n + k} \times \mathcal{A}^m
\longrightarrow
\mathcal{M}^{n + m + k}
$$
of $\mathcal{M}$. It is clear that we have defined a functor $[k]$,
that we have $[k + l] = [k] \circ [l]$, and that we have
$$
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(\mathcal{L}, \mathcal{M}[k]) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(\mathcal{L}, \mathcal{M})[k]
$$
(without the intervention of signs)
functorially in $\mathcal{M}$ and $\mathcal{L}$.
Thus we see indeed that the graded category of graded $\mathcal{A}$-modules
can be recovered from the ordinary category of graded $\mathcal{A}$-modules
and the shift functors as discussed in 
Differential Graded Algebra, Remark \ref{dga-remark-graded-shift-functors}.

\begin{lemma}
\label{lemma-gm-grothendieck-abelian}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a graded $\mathcal{O}$-algebra.
The category $\textit{Mod}(\mathcal{A})$ is a Grothendieck abelian category.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-gm-abelian} and the definition of a Grothendieck
abelian category
(Injectives, Definition \ref{injectives-definition-grothendieck-conditions})
it suffices to
show that $\textit{Mod}(\mathcal{A})$ has a generator. We claim that
$$
\mathcal{G} = \bigoplus\nolimits_{k, U} j_{U!}\mathcal{A}_U[k]
$$
is a generator where the sum is over all objects $U$ of $\mathcal{C}$
and $k \in \mathbf{Z}$. Indeed, given a graded $\mathcal{A}$-module
$\mathcal{M}$ if there are no nonzero maps from $\mathcal{G}$ to $\mathcal{M}$,
then we see that for all $k$ and $U$ we have
$$
\Hom_{\textit{Mod}(\mathcal{A})}(j_{U!}\mathcal{A}_U[k], \mathcal{M}) =
\Hom_{\textit{Mod}(\mathcal{A}_U)}(\mathcal{A}_U[k], \mathcal{M}|_U) =
\Gamma(U, \mathcal{M}^{-k})
$$
is equal to zero. Hence $\mathcal{M}$ is zero.
\end{proof}









\section{Sheaves of differential graded algebras}
\label{section-dga}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-dga}.

\begin{definition}
\label{definition-dga}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. A
{\it sheaf of differential graded $\mathcal{O}$-algebras}
or a {\it sheaf of differential graded algebras} on
$(\mathcal{C}, \mathcal{O})$ is a cochain complex
$\mathcal{A}^\bullet$ of $\mathcal{O}$-modules
endowed with $\mathcal{O}$-bilinear maps
$$
\mathcal{A}^n \times \mathcal{A}^m \to \mathcal{A}^{n + m},\quad
(a, b) \longmapsto ab
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication is associative,
\item there is a global section $1$ of $\mathcal{A}^0$
which is a two-sided identity for multiplication,
\item for $U \in \Ob(\mathcal{C})$, $a \in \mathcal{A}^n(U)$, and
$b \in \mathcal{A}^m(U)$ we have
$$
\text{d}^{n + m}(ab) = \text{d}^n(a)b + (-1)^n a\text{d}^m(b)
$$
\end{enumerate}
We often denote such a structure $(\mathcal{A}, \text{d})$.
A {\it homomorphism of differential graded $\mathcal{O}$-algebras}
from $(\mathcal{A}, \text{d})$ to $(\mathcal{B}, \text{d})$ is a map
$f : \mathcal{A}^\bullet \to \mathcal{B}^\bullet$ of complexes
of $\mathcal{O}$-modules compatible with the multiplication maps.
\end{definition}

\noindent
Given a differential graded $\mathcal{O}$-algebra $(\mathcal{A}, \text{d})$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{A}(U) =
\Gamma(U, \mathcal{A}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{A}^n(U)
$$
This is a differential graded $\mathcal{O}(U)$-algebra.

\medskip\noindent
As much as possible, we will think of a differential graded
$\mathcal{O}$-algebra $(\mathcal{A}, \text{d})$
as a graded $\mathcal{O}$-algebra $\mathcal{A}$ endowed with
the operator $\text{d} : \mathcal{A} \to \mathcal{A}$ of degree $1$
(where $\mathcal{A}$ is viewed as a graded $\mathcal{O}$-module)
satisfying the Leibniz rule given in the definition.

\begin{remark}
\label{remark-functoriality-dga}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi.
\begin{enumerate}
\item Let $(\mathcal{A}, \text{d})$ be a differential graded
$\mathcal{O}_\mathcal{C}$-algebra. The pushforward will be
the differential graded $\mathcal{O}_\mathcal{D}$-algebra
$(f_*\mathcal{A}, \text{d})$ where $f_*\mathcal{A}$ is as in
Remark \ref{remark-functoriality-ga} and
$\text{d} = f_*\text{d}$ as maps $f_*\mathcal{A}^n \to f_*\mathcal{A}^{n + 1}$.
We omit the verification that the Leibniz rule is satisfied.
\item Let $\mathcal{B}$ be a differential graded
$\mathcal{O}_\mathcal{D}$-algebra. The pullback will be the
differential graded $\mathcal{O}_\mathcal{C}$-algebra
$(f^*\mathcal{B}, \text{d})$ where $f^*\mathcal{B}$ is as in
Remark \ref{remark-functoriality-ga} and
$\text{d} = f^*\text{d}$ as maps $f^*\mathcal{B}^n \to f^*\mathcal{B}^{n + 1}$.
We omit the verification that the Leibniz rule is satisfied.
\item The set of homomorphisms $f^*\mathcal{B} \to \mathcal{A}$
of differential graded $\mathcal{O}_\mathcal{C}$-algebras is in
$1$-to-$1$ correspondence with the set of homomorphisms
$\mathcal{B} \to f_*\mathcal{A}$ of differential graded
$\mathcal{O}_\mathcal{D}$-algebras.
\end{enumerate}
Part (3) follows immediately from the usual adjunction between $f^*$ and $f_*$
on sheaves of modules.
\end{remark}
















\section{Sheaves of differential graded modules}
\label{section-modules}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-modules}.

\begin{definition}
\label{definition-dgm}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
A (right) {\it differential graded $\mathcal{A}$-module} or (right)
{\it differential graded module} over $\mathcal{A}$
is a cochain complex $\mathcal{M}^\bullet$ endowed with
$\mathcal{O}$-bilinear maps
$$
\mathcal{M}^n \times \mathcal{A}^m \to \mathcal{M}^{n + m},\quad
(x, a) \longmapsto xa
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication satisfies $(xa)a' = x(aa')$,
\item the identity section $1$ of $\mathcal{A}^0$
acts as the identity on $\mathcal{M}^n$ for all $n$,
\item for $U \in \Ob(\mathcal{C})$, $x \in \mathcal{M}^n(U)$, and
$a \in \mathcal{A}^m(U)$ we have
$$
\text{d}^{n + m}(xa) = \text{d}^n(x)a + (-1)^n x\text{d}^m(a)
$$
\end{enumerate}
We often say ``let $\mathcal{M}$ be a differential graded
$\mathcal{A}$-module'' to indicate this situation.
A {\it homomorphism of differential graded $\mathcal{A}$-modules}
from $\mathcal{M}$ to $\mathcal{N}$ is a map
$f : \mathcal{M}^\bullet \to \mathcal{N}^\bullet$ of complexes
of $\mathcal{O}$-modules compatible with the multiplication maps.
The category of (right) differential graded $\mathcal{A}$-modules
is denoted $\textit{Mod}(\mathcal{A}, \text{d})$.
\end{definition}

\noindent
We can define {\it left differential graded modules} in exactly the same manner
but our default in the chapter will be right modules.

\medskip\noindent
Given a differential graded $\mathcal{A}$-module $\mathcal{M}$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{M}(U) =
\Gamma(U, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{M}^n(U)
$$
This is a (right) differential graded $\mathcal{A}(U)$-module.

\begin{lemma}
\label{lemma-dgm-abelian}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a differential graded $\mathcal{O}$-algebra.
The category $\textit{Mod}(\mathcal{A}, \text{d})$ is an abelian category
with the following properties
\begin{enumerate}
\item $\textit{Mod}(\mathcal{A}, \text{d})$ has arbitrary direct sums,
\item $\textit{Mod}(\mathcal{A}, \text{d})$ has arbitrary colimits,
\item filtered colimit in $\textit{Mod}(\mathcal{A}, \text{d})$ are exact,
\item $\textit{Mod}(\mathcal{A}, \text{d})$ has arbitrary products,
\item $\textit{Mod}(\mathcal{A}, \text{d})$ has arbitrary limits.
\end{enumerate}
The forgetful functor
$$
\textit{Mod}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{A})
$$
sending a differential graded $\mathcal{A}$-module to its underlying
graded module commutes with all limits and colimits.
\end{lemma}

\begin{proof}
Let us denote
$F : \textit{Mod}(\mathcal{A}, \text{d}) \to \textit{Mod}(\mathcal{A})$
the functor in the statement of the lemma. Observe that
the category $\textit{Mod}(\mathcal{A})$ has properties (1) -- (5), see
Lemma \ref{lemma-gm-abelian}.

\medskip\noindent
Consider a homomorphism $f : \mathcal{M} \to \mathcal{N}$
of graded $\mathcal{A}$-modules. The kernel
and cokernel of $f$ as maps of graded $\mathcal{A}$-modules
are additionally endowed with differentials as in
Definition \ref{definition-dgm}. Hence these are also
the kernel and cokernel in $\textit{Mod}(\mathcal{A}, \text{d})$.
Thus $\textit{Mod}(\mathcal{A}, \text{d})$ is an abelian category
and taking kernels and cokernels commutes with $F$.

\medskip\noindent
To prove the existence of limits and colimits it is sufficient
to prove the existence of products and direct sums, see
Categories, Lemmas \ref{categories-lemma-limits-products-equalizers} and
\ref{categories-lemma-colimits-coproducts-coequalizers}.
The same lemmas show that
proving the commutation of limits and colimits with $F$
follows if $F$ commutes with direct sums and products.

\medskip\noindent
Let $\mathcal{M}_t$, $t \in T$ be a set of differential
graded $\mathcal{A}$-modules. Then we can consider the direct
sum $\bigoplus \mathcal{M}_t$ as a graded $\mathcal{A}$-module.
Since the direct sum of graded modules is done termwise, it is
clear that $\bigoplus \mathcal{M}_t$ comes endowed with a differential.
The reader easily verifies that this is a direct sum in
$\textit{Mod}(\mathcal{A}, \text{d})$. Similarly for products.

\medskip\noindent
Observe that $F$ is an exact functor and that
a complex $\mathcal{M}_1 \to \mathcal{M}_2 \to \mathcal{M}_3$
of $\textit{Mod}(\mathcal{A}, \text{d})$ is exact if and only if
$F(\mathcal{M}_1) \to F(\mathcal{M}_2) \to F(\mathcal{M}_3)$
is exact in $\textit{Mod}(\mathcal{A})$. Hence we conclude that (3)
holds as filtered colimits are exact in
$\textit{Mod}(\mathcal{A})$.
\end{proof}

\noindent
Combining Lemmas \ref{lemma-dgm-abelian} and \ref{lemma-gm-abelian}
we find that there is an exact and faithful functor
$$
\textit{Mod}(\mathcal{A}, \text{d}) \longrightarrow \text{Comp}(\mathcal{O})
$$
of abelian categories. For a differential graded $\mathcal{A}$-module
$\mathcal{M}$ the cohomology $\mathcal{O}$-modules, denoted $H^i(\mathcal{M})$,
are defined as the cohomology of the complex of
$\mathcal{O}$-modules corresponding to $\mathcal{M}$.
Therefore, a short exact sequence 
$0 \to \mathcal{K} \to \mathcal{L} \to \mathcal{M} \to 0$
of differential graded $\mathcal{A}$-modules
gives rise to a long exact sequence
\begin{equation}
\label{equation-les}
H^n(\mathcal{K}) \to H^n(\mathcal{L}) \to H^n(\mathcal{M}) \to
H^{n + 1}(\mathcal{K})
\end{equation}
of cohomology modules, see
Homology, Lemma \ref{homology-lemma-long-exact-sequence-cochain}.

\medskip\noindent
Moreover, from now on we borrow all the terminology used for
complexes of modules. For example, we say that a differential
graded $\mathcal{A}$-module $\mathcal{M}$ is {\it acyclic} if
$H^k(\mathcal{M}) = 0$ for all $k \in \mathbf{Z}$. We say that a
homomorphism $\mathcal{M} \to \mathcal{N}$
of differential graded $\mathcal{A}$-modules is a {\it quasi-isomorphism}
if it induces isomorphisms $H^k(\mathcal{M}) \to H^k(\mathcal{N})$
for all $k \in \mathbf{Z}$. And so on and so forth.


















\section{The differential graded category of modules}
\label{section-dgm-dg-cat}

\noindent
This section is the analogue of
Differential Graded Algebra, Example \ref{dga-example-dgm-dg-cat}.
For our conventions on differential graded categories, please
see Differential Graded Algebra, Section \ref{dga-section-dga-categories}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. We will construct
a differential graded category
$$
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
over $R = \Gamma(\mathcal{C}, \mathcal{O})$ whose associated category
of complexes is the category of differential graded $\mathcal{A}$-modules:
$$
\textit{Mod}(\mathcal{A}, \text{d}) =
\text{Comp}(\textit{Mod}^{dg}(\mathcal{A}, \text{d}))
$$
As objects of $\textit{Mod}^{dg}(\mathcal{A}, \text{d})$ we take right
differential graded $\mathcal{A}$-modules, see
Section \ref{section-modules}. Given differential graded
$\mathcal{A}$-modules $\mathcal{L}$ and $\mathcal{M}$ we set
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{L}, \mathcal{M}) =
\Hom_{\textit{Mod}^{gr}(\mathcal{A})}(\mathcal{L}, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \Hom^n(\mathcal{L}, \mathcal{M})
$$
as a graded $R$-module, see Section \ref{section-gm-gr-cat}.
In other words, the $n$th graded piece
$\Hom^n(\mathcal{L}, \mathcal{M})$ is the $R$-module of right
$\mathcal{A}$-module maps homogeneous of degree $n$.
For an element $f \in \Hom^n(\mathcal{L}, \mathcal{M})$ we set
$$
\text{d}(f) =
\text{d}_\mathcal{M} \circ f - (-1)^n f \circ \text{d}_\mathcal{L}
$$
To make sense of this we think of $\text{d}_\mathcal{M}$ and
$\text{d}_\mathcal{L}$ as graded $\mathcal{O}$-module maps and
we use composition of graded $\mathcal{O}$-module maps.
It is clear that $\text{d}(f)$ is homogeneous of
degree $n + 1$ as a graded $\mathcal{O}$-module map, and it is
$\mathcal{A}$-linear because for homogeneous local sections $x$ and $a$
of $\mathcal{M}$ and $\mathcal{A}$ we have
\begin{align*}
\text{d}(f)(xa)
& =
\text{d}_\mathcal{M}(f(x) a) - (-1)^n f (\text{d}_\mathcal{L}(xa)) \\
& =
\text{d}_\mathcal{M}(f(x)) a + (-1)^{\deg(x) + n} f(x) \text{d}(a) 
- (-1)^n f(\text{d}_\mathcal{L}(x)) a - (-1)^{n + \deg(x)} f(x) \text{d}(a) \\
& = \text{d}(f)(x) a
\end{align*}
as desired (observe that this calculation would not work without the
sign in the definition of our differential on $\Hom$).

\medskip\noindent
For differential graded $\mathcal{A}$-modules
$\mathcal{K}$, $\mathcal{L}$, $\mathcal{M}$
we have already defined the composition
$$
\Hom^m(\mathcal{L}, \mathcal{M}) \times
\Hom^n(\mathcal{K}, \mathcal{L}) \longrightarrow
\Hom^{n + m}(\mathcal{K}, \mathcal{M})
$$
in Section \ref{section-gm-gr-cat} by the usual composition
of maps of sheaves. This defines a map of differential graded modules
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{L}, \mathcal{M})
\otimes_R
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{K}, \mathcal{L})
\longrightarrow
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{K}, \mathcal{M})
$$
as required in
Differential Graded Algebra, Definition \ref{dga-definition-dga-category}
because
\begin{align*}
\text{d}(g \circ f) & =
\text{d}_\mathcal{M} \circ g \circ f
- (-1)^{n + m} g \circ f \circ \text{d}_\mathcal{K} \\
& =
\left(\text{d}_\mathcal{M} \circ g - (-1)^m g \circ \text{d}_L\right) \circ f
+ (-1)^m g \circ \left(\text{d}_\mathcal{L} \circ f
- (-1)^n f \circ \text{d}_\mathcal{K}\right) \\
& =
\text{d}(g) \circ f + (-1)^m g \circ \text{d}(f)
\end{align*}
if $f$ has degree $n$ and $g$ has degree $m$ as desired.






\section{Tensor product for sheaves of differential graded modules}
\label{section-tensor-product-dg}

\noindent
This section is the analogue of part of
Differential Graded Algebra, Section \ref{dga-section-tensor-product}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{M}$ be a right differential graded $\mathcal{A}$-module
and let $\mathcal{N}$ be a left differential graded $\mathcal{A}$-module.
In this situation we define the {\it tensor product}
$\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ as follows.
As a graded $\mathcal{O}$-module it is given by the construction
in Section \ref{section-tensor-product}. It comes endowed
with a differential
$$
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}} :
(\mathcal{M} \otimes_\mathcal{A} \mathcal{N})^n
\longrightarrow
(\mathcal{M} \otimes_\mathcal{A} \mathcal{N})^{n + 1}
$$
defined by the rule that
$$
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}}(x \otimes y) =
\text{d}_\mathcal{M}(x) \otimes y +
(-1)^{\deg(x)}x \otimes \text{d}_\mathcal{N}(y)
$$
for homogeneous local sections $x$ and $y$ of $\mathcal{M}$ and $\mathcal{N}$.
To see that this is well defined we have to show that
$\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}}$ annihilates
elements of the form $xa \otimes y - x \otimes ay$ for homogeneous
local sections $x$, $a$, $y$ of $\mathcal{M}$, $\mathcal{A}$, $\mathcal{N}$.
We compute
\begin{align*}
&
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}}(
xa \otimes y - x \otimes ay) \\
& =
\text{d}_\mathcal{M}(xa) \otimes y + (-1)^{\deg(x) + \deg(a)}
xa \otimes \text{d}_\mathcal{N}(y)
-\text{d}_\mathcal{M}(x) \otimes ay - (-1)^{\deg(x)}
x \otimes \text{d}_\mathcal{N}(ay) \\
& =
\text{d}_\mathcal{M}(x)a \otimes y + (-1)^{\deg(x)}x\text{d}(a) \otimes y
+ (-1)^{\deg(x) + \deg(a)} xa \otimes \text{d}_\mathcal{N}(y) \\
&
-\text{d}_\mathcal{M}(x) \otimes ay - (-1)^{\deg(x)}
x \otimes \text{d}(a)y - (-1)^{\deg(x) +
\deg(a)} x\otimes a\text{d}_\mathcal{N}(y)
\end{align*}
then we observe that the elements
$$
\text{d}_\mathcal{M}(x)a \otimes y - \text{d}_\mathcal{M}(x) \otimes ay,\quad
x\text{d}(a) \otimes y - x \otimes \text{d}(a)y,\quad
\text{and}\quad
xa \otimes \text{d}_\mathcal{N}(y) - x\otimes a\text{d}_\mathcal{N}(y)
$$
map to zero in $\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$
and we conclude. We omit the verification that
$\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}} \circ
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}} = 0$.

\medskip\noindent
If we fix the left differential graded $\mathcal{A}$-module $\mathcal{N}$
we obtain a functor
$$
- \otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}(\mathcal{A}, \text{d})
\longrightarrow
\text{Comp}(\mathcal{O})
$$
where on the right hand side we have the category of complexes of
$\mathcal{O}$-modules. This can be upgraded to a functor of
differential graded categories
$$
- \otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\text{Comp}^{dg}(\mathcal{O})
$$
On underlying graded objects, we send
a homomorphism $f : \mathcal{M} \to \mathcal{M}'$ of degree $n$ 
to the degree $n$ map
$f \otimes \text{id}_\mathcal{N} :
\mathcal{M} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}$, because
this is what we did in Section \ref{section-tensor-product}.
To show that this works, we have to verify that the map
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{M}')
\longrightarrow
\Hom_{\text{Comp}^{dg}(\mathcal{O})}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{N},
\mathcal{M}' \otimes_\mathcal{A} \mathcal{N})
$$
is compatible with differentials. To see this for $f$ as above
we have to show that
$$
(\text{d}_{\mathcal{M}'} \circ f - (-1)^n f \circ \text{d}_\mathcal{M})
\otimes \text{id}_\mathcal{N}
$$
is equal to
$$
\text{d}_{\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}}
\circ (f \otimes \text{id}_\mathcal{N})
- (-1)^n (f \otimes \text{id}_\mathcal{N}) \circ
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}}
$$
Let us compute the effect of these operators on a local section
of the form $x \otimes y$ with $x$ and $y$ homogeneous local sections
of $\mathcal{M}$ and $\mathcal{N}$. For the first we obtain
$$
(\text{d}_{\mathcal{M}'}(f(x)) - (-1)^n f(\text{d}_\mathcal{M}(x))) \otimes y
$$
and for the second we obtain
\begin{align*}
&\text{d}_{\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}}(f(x) \otimes y)
- (-1)^n (f \otimes \text{id}_\mathcal{N})(
\text{d}_{\mathcal{M} \otimes_\mathcal{A} \mathcal{N}}(x \otimes y) \\
& =
\text{d}_{\mathcal{M}'}(f(x)) \otimes y +
(-1)^{\deg(x) + n}f(x) \otimes \text{d}_\mathcal{N}(y) \\
&
-(-1)^n f(\text{d}_\mathcal{M}(x)) \otimes y
-(-1)^n (-1)^{\deg(x)}f(x) \otimes \text{d}_\mathcal{N}(y)
\end{align*}
which is indeeed the same local section.










\section{Internal hom for sheaves of differential graded modules}
\label{section-internal-hom-dg}

\noindent
We are going to need the sheafified version of the construction
in Section \ref{section-dgm-dg-cat}.
Let $(\mathcal{C}, \mathcal{O})$, $\mathcal{A}$,
$\mathcal{M}$, $\mathcal{L}$ be as in Section \ref{section-dgm-dg-cat}.
Then we define
$$
\SheafHom^{dg}_\mathcal{A}(\mathcal{M}, \mathcal{L}) =
\SheafHom^{gr}_\mathcal{A}(\mathcal{M}, \mathcal{L}) =
\bigoplus\nolimits_{n \in \mathbf{Z}}
\SheafHom^n_\mathcal{A}(\mathcal{M}, \mathcal{L})
$$
as a graded $\mathcal{O}$-module, see
Section \ref{section-internal-hom-graded}.
In other words, a section $f$ of the $n$th graded piece
$\SheafHom^n_\mathcal{A}(\mathcal{L}, \mathcal{M})$ over $U$
is a map of right $\mathcal{A}_U$-module map
$\mathcal{L}|_U \to \mathcal{M}|_U$ homogeneous of degree $n$.
For such $f$ we set
$$
\text{d}(f) =
\text{d}_\mathcal{M}|_U \circ f - (-1)^n f \circ \text{d}_\mathcal{L}|_U
$$
To make sense of this we think of $\text{d}_\mathcal{M}|_U$ and
$\text{d}_\mathcal{L}|_U$ as graded $\mathcal{O}_U$-module maps and
we use composition of graded $\mathcal{O}_U$-module maps.
It is clear that $\text{d}(f)$ is homogeneous of
degree $n + 1$ as a graded $\mathcal{O}_U$-module map.
Using the exact same computation as in Section \ref{section-dgm-dg-cat}
we see that $\text{d}(f)$ is $\mathcal{A}_U$-linear.

\medskip\noindent
As in Section \ref{section-dgm-dg-cat} there is a composition map
$$
\SheafHom^{dg}_\mathcal{A}(\mathcal{L}, \mathcal{M}) \otimes_\mathcal{O}
\SheafHom^{dg}_\mathcal{A}(\mathcal{K}, \mathcal{L})
\longrightarrow
\SheafHom^{dg}_\mathcal{A}(\mathcal{K}, \mathcal{M})
$$
where the left hand side is the tensor product of
differential graded $\mathcal{O}$-modules
defined in Section \ref{section-tensor-product-dg}. This map
is given by the composition map
$$
\SheafHom^m(\mathcal{L}, \mathcal{M}) \otimes_\mathcal{O}
\SheafHom^n(\mathcal{K}, \mathcal{L}) \longrightarrow
\SheafHom^{n + m}(\mathcal{K}, \mathcal{M})
$$
defined by simple composition (locally). Using the exact same
computation as in Section \ref{section-dgm-dg-cat} on local sections
we see that the composition map is a morphism of differential
graded $\mathcal{O}$-modules.

\medskip\noindent
With these definitions we have
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A})}(\mathcal{L}, \mathcal{M}) =
\Gamma(\mathcal{C}, \SheafHom^{dg}_\mathcal{A}(\mathcal{L}, \mathcal{M}))
$$
as graded $R$-modules compatible with composition.









\section{Sheaves of differential graded bimodules and tensor-hom adjunction}
\label{section-dg-bimodules}

\noindent
This section is the analogue of part of
Differential Graded Algebra, Section \ref{dga-section-tensor-product}.

\begin{definition}
\label{definition-dg-bimodule}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. A
{\it differential graded $(\mathcal{A}, \mathcal{B})$-bimodule}
is given by a complex $\mathcal{M}^\bullet$
of $\mathcal{O}$-modules endowed with $\mathcal{O}$-bilinear maps
$$
\mathcal{M}^n \times \mathcal{B}^m \to \mathcal{M}^{n + m},\quad
(x, b) \longmapsto xb
$$
and
$$
\mathcal{A}^n \times \mathcal{M}^m \to \mathcal{M}^{n + m},\quad
(a, x) \longmapsto ax
$$
called the multiplication maps with the following properties
\begin{enumerate}
\item multiplication satisfies $a(a'x) = (aa')x$ and
$(xb)b' = x(bb')$,
\item $(ax)b = a(xb)$,
\item $\text{d}(ax) = \text{d}(a) x + (-1)^{\deg(a)}a \text{d}(x)$ and
$\text{d}(xb) = \text{d}(x) b + (-1)^{\deg(x)}x \text{d}(b)$,
\item the identity section $1$ of $\mathcal{A}^0$ acts as the
identity by multiplication, and
\item the identity section $1$ of
$\mathcal{B}^0$ acts as the identity by multiplication.
\end{enumerate}
We often denote such a structure $\mathcal{M}$ and sometimes
we write ${}_\mathcal{A}\mathcal{M}_\mathcal{B}$.
A {\it homomorphism of differential graded
$(\mathcal{A}, \mathcal{B})$-bimodules}
$f : \mathcal{M} \to \mathcal{N}$ is a map of complexes
$f : \mathcal{M}^\bullet \to \mathcal{N}^\bullet$
of $\mathcal{O}$-modules compatible with the multiplication maps.
\end{definition}

\noindent
Given a differential graded $(\mathcal{A}, \mathcal{B})$-bimodule $\mathcal{M}$
and an object $U \in \Ob(\mathcal{C})$ we use the notation
$$
\mathcal{M}(U) =
\Gamma(U, \mathcal{M}) =
\bigoplus\nolimits_{n \in \mathbf{Z}} \mathcal{M}^n(U)
$$
This is a differential graded $(\mathcal{A}(U), \mathcal{B}(U))$-bimodule.

\medskip\noindent
Observe that a differential graded $(\mathcal{A}, \mathcal{B})$-bimodule
$\mathcal{M}$ is the same thing as a right differential graded
$\mathcal{B}$-module which is also a left differential graded
$\mathcal{A}$-module such that the grading and differentials agree
and such that the $\mathcal{A}$-module structure commutes with
the $\mathcal{B}$-module structure. Here is a precise statement.

\begin{lemma}
\label{lemma-what-makes-a-bimodule-dg}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{N}$ be a right differential
graded $\mathcal{B}$-module. There is a $1$-to-$1$ correspondence
between $(\mathcal{A}, \mathcal{B})$-bimodule structures on
$\mathcal{N}$ compatible with the given
differential graded $\mathcal{B}$-module structure and homomorphisms
$$
\mathcal{A}
\longrightarrow
\SheafHom^{dg}_\mathcal{B}(\mathcal{N}, \mathcal{N})
$$
of differential graded $\mathcal{O}$-algebras.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$ be a right
differential graded $\mathcal{A}$-module and let $\mathcal{N}$ be a
differential graded $(\mathcal{A}, \mathcal{B})$-bimodule. In this case the
differential graded tensor product defined in
Section \ref{section-tensor-product-dg}
$$
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}
$$
is a right differential graded $\mathcal{B}$-module with
multiplication maps as in Section \ref{section-graded-bimodules}.
This construction defines a functor and a functor of graded categories
$$
\otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{B}, \text{d})
\quad\text{and}\quad
\otimes_\mathcal{A} \mathcal{N} :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
$$
by sending homomorphisms of degree $n$ from $\mathcal{M} \to \mathcal{M}'$
to the induced map of degree $n$ from
$\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ to
$\mathcal{M}' \otimes_\mathcal{A} \mathcal{N}$.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{N}$ be a
differential graded $(\mathcal{A}, \mathcal{B})$-bimodule. Let 
$\mathcal{L}$ be a right differential graded $\mathcal{B}$-module.
In this case the differential graded internal hom
defined in Section \ref{section-internal-hom-dg}
$$
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L})
$$
is a right differential graded $\mathcal{A}$-module where the
right graded $\mathcal{A}$-module structure is the one defined
in Section \ref{section-graded-bimodules}. Another way to define
the multiplication is the use the composition
$$
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L})
\otimes_\mathcal{O} \mathcal{A}
\to
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L})
\otimes_\mathcal{O} \SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{N})
\to
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L})
$$
where the first arrow comes from Lemma \ref{lemma-what-makes-a-bimodule-dg}
and the second arrow is the composition of
Section \ref{section-internal-hom-dg}. Since these arrows are
both compatible with differentials, we conclude that we indeed
obtain a differential graded $\mathcal{A}$-module.
This construction
defines a functor and a functor of differential graded categories
$$
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, -) :
\textit{Mod}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{A})
\quad\text{and}\quad
\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, -) :
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
by sending homomorphisms of degree $n$ from $\mathcal{L} \to \mathcal{L}'$
to the induced map of degree $n$ from
$\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L})$ to
$\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L}')$.

\begin{lemma}
\label{lemma-tensor-hom-adjunction-dg}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$ be a right
differential graded $\mathcal{A}$-module. Let $\mathcal{N}$ be a
differential graded $(\mathcal{A}, \mathcal{B})$-bimodule. Let $\mathcal{L}$
be a right differential graded $\mathcal{B}$-module. With conventions as above
we have
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{B}, \text{d})}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}, \mathcal{L}) =
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(
\mathcal{M}, \SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L}))
$$
and
$$
\SheafHom_\mathcal{B}^{dg}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}, \mathcal{L}) =
\SheafHom_\mathcal{A}^{dg}(
\mathcal{M}, \SheafHom_\mathcal{B}^{dg}(\mathcal{N}, \mathcal{L}))
$$
functorially in $\mathcal{M}$, $\mathcal{N}$, $\mathcal{L}$.
\end{lemma}

\begin{proof}
Omitted. Hint: On the graded level we have seen this is true in
Lemma \ref{lemma-tensor-hom-adjunction-gr}. Thus it suffices
to check the isomorphisms are compatible with differentials
which can be done by a computation on the level of local sections.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
and $\mathcal{B}$ be a sheaves of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$.
As a special case of the above, suppose we are given
a homomorphism $\varphi : \mathcal{A} \to \mathcal{B}$
of differential graded $\mathcal{O}$-algebras. Then we obtain a functor
and a functor of differential graded categories
$$
\otimes_{\mathcal{A}, \varphi} \mathcal{B} :
\textit{Mod}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{B}, \text{d})
\quad\text{and}\quad
\otimes_{\mathcal{A}, \varphi} \mathcal{B} :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
$$
On the other hand, we have the restriction functors
$$
res_\varphi :
\textit{Mod}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{A}, \text{d})
\quad\text{and}\quad
res_\varphi :
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
We can use the lemma above to show these functors are adjoint to
each other (as usual with restriction and base change). Namely,
let us write ${}_\mathcal{A}\mathcal{B}_\mathcal{B}$ for
$\mathcal{B}$ viewed as a differential graded
$(\mathcal{A}, \mathcal{B})$-bimodule.
Then for any right differential graded $\mathcal{B}$-module $\mathcal{L}$
we have
$$
\SheafHom_\mathcal{B}^{dg}({}_\mathcal{A}\mathcal{B}_\mathcal{B}, \mathcal{L})
= res_\varphi(\mathcal{L})
$$
as right differential graded $\mathcal{A}$-modules. Thus
Lemma \ref{lemma-tensor-hom-adjunction-gr}
tells us that we have a functorial isomorphism
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{B}, \text{d})}(
\mathcal{M} \otimes_{\mathcal{A}, \varphi} \mathcal{B}, \mathcal{L}) =
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(
\mathcal{M}, res_\varphi(\mathcal{L}))
$$
We usually drop the dependence on $\varphi$ in this formula if it
is clear from context. In the same manner we obtain
the equality
$$
\SheafHom^{dg}_\mathcal{B}(
\mathcal{M} \otimes_\mathcal{A} \mathcal{B}, \mathcal{L}) =
\SheafHom_\mathcal{A}^{dg}(\mathcal{M}, \mathcal{L})
$$
of graded $\mathcal{O}$-modules.












\section{Pull and push for sheaves of differential graded modules}
\label{section-functoriality-dg}

\noindent
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra.
Suppose we are given a map
$$
\varphi : f^{-1}\mathcal{B} \to \mathcal{A}
$$
of differential graded $f^{-1}\mathcal{O}_\mathcal{D}$-algebras.
By the adjunction of restriction and extension of scalars, this
is the same thing as a map $\varphi : f^*\mathcal{B} \to \mathcal{A}$
of differential graded $\mathcal{O}_\mathcal{C}$-algebras or equivalently
$\varphi$ can be viewed as a map
$$
\varphi : \mathcal{B} \to f_*\mathcal{A}
$$
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
See Remark \ref{remark-functoriality-dga}.

\medskip\noindent
Let us define a functor
$$
f_* :
\textit{Mod}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{B}, \text{d})
$$
Given a differential graded $\mathcal{A}$-module $\mathcal{M}$ we define
$f_*\mathcal{M}$ to be the graded $\mathcal{B}$-module constructed
in Section \ref{section-functoriality-graded} with differential
given by the maps $f_*d : f_*\mathcal{M}^n \to f_*\mathcal{M}^{n + 1}$.
The construction is clearly functorial in
$\mathcal{M}$ and we obtain our functor.

\medskip\noindent
Let us define a functor
$$
f^* :
\textit{Mod}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{A}, \text{d})
$$
Given a differential graded $\mathcal{B}$-module $\mathcal{N}$
we define $f^*\mathcal{N}$ to be the graded $\mathcal{A}$-module
constructed in Section \ref{section-functoriality-graded}. Recall
that
$$
f^*\mathcal{N} = f^{-1}\mathcal{N} \otimes_{f^{-1}\mathcal{B}} \mathcal{A}
$$
Since $f^{-1}\mathcal{N}$ comes with the differentials
$f^{-1}\text{d} : f^{-1}\mathcal{N}^n \to f^{-1}\mathcal{N}^{n + 1}$
we can view this tensor product as an example of the
tensor product discussed in Section \ref{section-dg-bimodules}
which provides us with a differential.
The construction is clearly functorial in
$\mathcal{N}$ and we obtain our functor $f^*$.

\medskip\noindent
The functors $f_*$ and $f^*$ are readily enhanced to give
functors of differential graded categories
$$
f_* :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
\quad\text{and}\quad
f^* :
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
which do the same thing on underlying objects and are defined
by functoriality of the constructions on homogenous morphisms
of degree $n$.

\begin{lemma}
\label{lemma-adjunction-push-pull-dg}
In the situation above we have
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{B}, \text{d})}(
\mathcal{N}, f_*\mathcal{M}) =
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(
f^*\mathcal{N}, \mathcal{M})
$$
\end{lemma}

\begin{proof}
Omitted. Hints: This is true for the underlying graded categories
by Lemma \ref{lemma-adjunction-push-pull-gr}. A calculation shows
that these isomorphisms are compatible with differentials.
\end{proof}















\section{Localization and sheaves of differential graded modules}
\label{section-localize-dg}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $U \in \Ob(\mathcal{C})$ and denote
$$
j :
(\Sh(\mathcal{C}/U), \mathcal{O}_U)
\longrightarrow
(\Sh(\mathcal{C}), \mathcal{O})
$$
the corresponding localization morphism
(Modules on Sites, Section \ref{sites-modules-section-localize}).
Below we will use the following fact: for $\mathcal{O}_U$-modules
$\mathcal{M}_i$, $i = 1, 2$ and a $\mathcal{O}$-module $\mathcal{A}$
there is a canonical map
$$
j_! :
\Hom_{\mathcal{O}_U}(
\mathcal{M}_1 \otimes_{\mathcal{O}_U} \mathcal{A}|_U, \mathcal{M}_2)
\longrightarrow
\Hom_\mathcal{O}(
j_!\mathcal{M}_1 \otimes_\mathcal{O} \mathcal{A}, j_!\mathcal{M}_2)
$$
Namely, we have
$j_!(\mathcal{M}_1 \otimes_{\mathcal{O}_U} \mathcal{A}|_U) =
j_!\mathcal{M}_1 \otimes_\mathcal{O} \mathcal{A}$ by
Modules on Sites, Lemma \ref{sites-modules-lemma-j-shriek-and-tensor}.

\medskip\noindent
Let $\mathcal{A}$ be a differential graded $\mathcal{O}$-algebra.
We will denote $\mathcal{A}_U$ the restriction of $\mathcal{A}$
to $\mathcal{C}/U$, in other words, we have
$\mathcal{A}_U = j^*\mathcal{A} = j^{-1}\mathcal{A}$.
In Section \ref{section-functoriality-dg}
we have constructed adjoint functors
$$
j_* :
\textit{Mod}^{dg}(\mathcal{A}_U, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\quad\text{and}\quad
j^* :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}_U, \text{d})
$$
with $j^*$ left adjoint to $j_*$. We claim there is in addition an
exact functor
$$
j_! :
\textit{Mod}^{dg}(\mathcal{A}_U, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
right adjoint to $j_*$. Namely, given a differential graded
$\mathcal{A}_U$-module $\mathcal{M}$ we define $j_!\mathcal{M}$
to be the graded $\mathcal{A}$-module constructed in
Section \ref{section-localize-graded}
with differentials
$j_!\text{d} : j_!\mathcal{M}^n \to j_!\mathcal{M}^{n + 1}$.
Given a homogeneous map
$f : \mathcal{M} \to \mathcal{M}'$ of degree $n$ of differential graded
$\mathcal{A}_U$-modules, we obtain a homogeneous map
$j_!f : j_!\mathcal{M} \to j_!\mathcal{M}'$ of degree $n$
of differential graded $\mathcal{A}$-modules. We omit the
straightforward verification
that this construction is compatible with differentials.
Thus we obtain our functor.

\begin{lemma}
\label{lemma-extension-by-zero-dg}
In the situation above we have
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(
j_!\mathcal{M}, \mathcal{N}) =
\Hom_{\textit{Mod}^{dg}(\mathcal{A}_U, \text{d})}(
\mathcal{M}, j^*\mathcal{N})
$$
\end{lemma}

\begin{proof}
Omitted. Hint: We have seen in Lemma \ref{lemma-extension-by-zero-graded}
that the lemma is true on graded level. Thus all that needs to be
checked is that the resulting isomorphism is compatible with differentials.
\end{proof}

\begin{lemma}
\label{lemma-tensor-with-extension-by-zero-dg}
In the situation above, let $\mathcal{M}$ be a right differential graded
$\mathcal{A}_U$-module and let $\mathcal{N}$ be a left differential graded
$\mathcal{A}$-module. Then
$$
j_!\mathcal{M} \otimes_\mathcal{A} \mathcal{N} =
j_!(\mathcal{M} \otimes_{\mathcal{A}_U} \mathcal{N}|_U)
$$
as complexes of $\mathcal{O}$-modules
functorially in $\mathcal{M}$ and $\mathcal{N}$.
\end{lemma}

\begin{proof}
As graded modules, this follows from
Lemma \ref{lemma-tensor-with-extension-by-zero}.
We omit the verification that this isomorphism
is compatible with differentials.
\end{proof}








\section{Shift functors on sheaves of differential graded modules}
\label{section-shift-dg}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{M}$ be a differential graded $\mathcal{A}$-module.
Let $k \in \mathbf{Z}$. We define the {\it $k$th shift of} $\mathcal{M}$,
denoted $\mathcal{M}[k]$, as follows
\begin{enumerate}
\item as a graded $\mathcal{A}$-module we let $\mathcal{M}[k]$ be
as defined in Section \ref{section-shift},
\item the differential
$d_{\mathcal{M}[k]} : (\mathcal{M}[k])^n \to (\mathcal{M}[k])^{n + 1}$
is defined to be
$(-1)^k\text{d}_\mathcal{M} : \mathcal{M}^{n + k} \to \mathcal{M}^{n + k + 1}$.
\end{enumerate}
For a homomorphism $f : \mathcal{L} \to \mathcal{M}$ of $\mathcal{A}$-modules
homogeneous of degree $n$, we let $f[k] : \mathcal{L}[k] \to \mathcal{M}[k]$
be given by the same component maps as $f$. Then $f[k]$ is
a homogeneous $\mathcal{A}$-module map of degree $n$.
This gives a map
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{L}, \mathcal{M})
\longrightarrow
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}
(\mathcal{L}[k], \mathcal{M}[k])
$$
compatible with differentials (it follows from the fact
that the signs of the differentials of $\mathcal{L}$ and
$\mathcal{M}$ are changed by the same amount). These choices are
compatible with the choice in
Differential Graded Algebra, Definition \ref{dga-definition-shift}.
It is clear that we have defined a functor
$$
[k] :
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}, \text{d})
$$
of differential graded categories and that we have
$[k + l] = [k] \circ [l]$.

\medskip\noindent
We claim that the isomorphism
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{L}, \mathcal{M}[k])
=
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{L}, \mathcal{M})[k]
$$
defined in Section \ref{section-shift} on underlying graded modules
is compatible with
the differentials. To see this, suppose we have a right $\mathcal{A}$-module
map $f : \mathcal{L} \to \mathcal{M}[k]$ homogeneous of degree $n$; this
is an element of degree $n$ of the LHS. Denote
$f' : \mathcal{L} \to \mathcal{M}$ the homogeneous $\mathcal{A}$-module
map of degree $n + k$ with the {\bf same} component maps as $f$.
By our conventions, this is the corresponding element of degree $n$
of the RHS.
By definition of the differential of LHS we obtain
$$
\text{d}_{LHS}(f) =
\text{d}_{\mathcal{M}[k]} \circ f - (-1)^n f \circ \text{d}_\mathcal{L} =
(-1)^k\text{d}_\mathcal{M} \circ f - (-1)^n f \circ \text{d}_\mathcal{L}
$$
and for the differential on the RHS we obtain
$$
\text{d}_{RHS}(f') =
(-1)^k\left(
\text{d}_\mathcal{M} \circ f' - (-1)^{n + k} f' \circ \text{d}_\mathcal{L}
\right) =
(-1)^k\text{d}_\mathcal{M} \circ f' - (-1)^n f' \circ \text{d}_\mathcal{L}
$$
These maps have the same component maps and the proof is complete.










\section{The homotopy category}
\label{section-homotopy}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-homotopy}.

\begin{definition}
\label{definition-homotopy}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let
$f, g : \mathcal{M} \to \mathcal{N}$
be homomorphisms of differential graded $\mathcal{A}$-modules.
A {\it homotopy between $f$ and $g$} is a graded $\mathcal{A}$-module
map $h : \mathcal{M} \to \mathcal{N}$ homogeneous of degree $-1$
such that
$$
f - g = \text{d}_\mathcal{N} \circ h + h \circ \text{d}_\mathcal{M}
$$
If a homotopy exists, then we say $f$ and $g$ are {\it homotopic}.
\end{definition}

\noindent
In the situation of the definition, if we have maps
$a : \mathcal{K} \to \mathcal{M}$ and $c : \mathcal{N} \to \mathcal{L}$
then we see that
$$
\begin{matrix}
h\text{ is a homotopy} \\
\text{ between }f\text{ and } g
\end{matrix}
\quad
\Rightarrow
\quad
\begin{matrix}
c \circ h \circ a\text{ is a homotopy}\\
\text{between }
c \circ f \circ a\text{ and } c\circ g \circ a
\end{matrix}
$$
Thus we can define composition of homotopy classes of morphisms
in $\textit{Mod}(\mathcal{A}, \text{d})$.

\begin{definition}
\label{definition-complexes-notation}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
The {\it homotopy category}, denoted $K(\textit{Mod}(\mathcal{A}, \text{d}))$,
is the category whose objects are the objects of
$\textit{Mod}(\mathcal{A}, \text{d})$ and whose morphisms are homotopy classes
of homomorphisms of differential graded $\mathcal{A}$-modules.
\end{definition}

\noindent
The notation $K(\textit{Mod}(\mathcal{A}, \text{d}))$
is not standard but at least is
consistent with the use of $K(-)$ in other places of the Stacks project.

\medskip\noindent
In Differential Graded Algebra, Definition
\ref{dga-definition-homotopy-category-of-dga-category}
we have defined what we mean by the category of complexes
$\text{Comp}(\mathcal{S})$
and the homotopy category $K(\mathcal{S})$
of a differential graded category $\mathcal{S}$.
Applying this to the differential graded category
$\textit{Mod}^{dg}(\mathcal{A}, \text{d})$ we obtain
$$
\textit{Mod}(\mathcal{A}, \text{d}) =
\text{Comp}(\textit{Mod}^{dg}(\mathcal{A}, \text{d}))
$$
(see discussion in Section \ref{section-dgm-dg-cat}) and we obtain
$$
K(\textit{Mod}(\mathcal{A}, \text{d})) =
K(\textit{Mod}^{dg}(\mathcal{A}, \text{d}))
$$
To see that this last equality is true, note that we have the equality
$$
\text{d}_{\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}
(\mathcal{M}, \mathcal{N})}(h) =
\text{d}_\mathcal{N} \circ h + h \circ \text{d}_\mathcal{M}
$$
when $h$ is as in Definition \ref{definition-homotopy}. We omit the
details.

\begin{lemma}
\label{lemma-homotopy-direct-sums}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
The homotopy category $K(\textit{Mod}(\mathcal{A}, \text{d}))$
has direct sums and products.
\end{lemma}

\begin{proof}
Omitted. Hint: Just use the direct sums and products as in
Lemma \ref{lemma-dgm-abelian}. This works because we saw that
these functors commute with the forgetful functor to the category
of graded $\mathcal{A}$-modules and because $\prod$ and $\bigoplus$
are exact functors on the category of families of abelian groups.
\end{proof}










\section{Cones and triangles}
\label{section-conclude-triangulated}

\noindent
In this section we use the material from
Differential Graded Algebra, Section \ref{dga-section-review}
to conclude that the homotopy category of the
category of differential graded $\mathcal{A}$-modules
is a triangulated category.

\begin{lemma}
\label{lemma-axioms-AB}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
The differential graded category
$\textit{Mod}^{dg}(\mathcal{A}, \text{d})$
satisfies axioms (A) and (B) of
Differential Graded Algebra, Section \ref{dga-section-review}.
\end{lemma}

\begin{proof}
Suppose given differential graded $\mathcal{A}$-modules
$\mathcal{M}$ and $\mathcal{N}$. Consider the
differential graded $\mathcal{A}$-module $\mathcal{M} \oplus \mathcal{N}$
defined in the obvious manner. Then the coprojections
$i : \mathcal{M} \to \mathcal{M} \oplus \mathcal{N}$ and
$j : \mathcal{N} \to \mathcal{M} \oplus \mathcal{N}$ and the
projections
$p : \mathcal{M} \oplus \mathcal{N} \to \mathcal{N}$ and
$q : \mathcal{M} \oplus \mathcal{N} \to \mathcal{M}$
are morphisms of differential graded $\mathcal{A}$-modules.
Hence $i, j, p, q$ are homogeneous
of degree $0$ and closed, i.e., $\text{d}(i) = 0$, etc.
Thus this direct sum is a differential graded sum in the sense of
Differential Graded Algebra, Definition \ref{dga-definition-dg-direct-sum}.
This proves axiom (A).

\medskip\noindent
Axiom (B) was shown in Section \ref{section-shift-dg}.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Recall that a sequence
$$
0 \to \mathcal{K} \to \mathcal{L} \to \mathcal{N} \to 0
$$
in $\textit{Mod}(\mathcal{A}, \text{d})$
is called an {\it admissible short exact sequence}
(in Differential Graded Algebra, Section \ref{dga-section-review})
if it is split in $\textit{Mod}(\mathcal{A})$. In other words, if it is split
as a sequence of graded $\mathcal{A}$-modules. Denote
$s : \mathcal{N} \to \mathcal{L}$ and
$\pi : \mathcal{L} \to \mathcal{K}$
graded $\mathcal{A}$-module splittings.
Combining Lemma \ref{lemma-axioms-AB} and 
Differential Graded Algebra, Lemma \ref{dga-lemma-get-triangle}
we obtain a triangle
$$
\mathcal{K} \to \mathcal{L} \to \mathcal{N} \to \mathcal{K}[1]
$$
where the arrow $\mathcal{N} \to \mathcal{K}[1]$ in the proof
of Differential Graded Algebra, Lemma \ref{dga-lemma-get-triangle}
is constructed as
$$
\delta = \pi \circ
\text{d}_{\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}
(\mathcal{L}, \mathcal{M})}(s) =
\pi \circ \text{d}_\mathcal{L} \circ s -
\pi \circ s \circ \text{d}_\mathcal{N} =
\pi \circ \text{d}_\mathcal{L} \circ s
$$
with apologies for the horrendous notation. In any case, we see that
in our setting the boundary map $\delta$ as constructed in
Differential Graded Algebra, Lemma \ref{dga-lemma-get-triangle}
agrees on underlying complexes of $\mathcal{O}$-modules
with the usual boundary map used throughout the Stacks project
for termwise split short exact sequences of complexes, see
Derived Categories, Definition \ref{derived-definition-split-ses}.

\begin{definition}
\label{definition-cone}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Let $f : \mathcal{K} \to \mathcal{L}$
be a homomorphism of differential graded $\mathcal{A}$-modules.
The {\it cone} of $f$ is the differential graded $\mathcal{A}$-module
$C(f)$ defined as follows:
\begin{enumerate}
\item the underlying complex of $\mathcal{O}$-modules
is the cone of the corresponding map
$f : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$ of
complexes of $\mathcal{A}$-modules, i.e., we have
$C(f)^n = \mathcal{L}^n \oplus \mathcal{K}^{n + 1}$ and
differential
$$
d_{C(f)} =
\left(
\begin{matrix}
\text{d}_\mathcal{L} & f \\
0 & -\text{d}_\mathcal{K}
\end{matrix}
\right)
$$
\item the multiplication map
$$
C(f)^n \times \mathcal{A}^m \to C(f)^{n + m}
$$
is the direct sum of the multiplication map
$\mathcal{L}^n \times \mathcal{A}^m \to \mathcal{L}^{n + m}$
and the multiplication map
$\mathcal{K}^{n + 1} \times \mathcal{A}^m \to \mathcal{K}^{n + 1 + m}$.
\end{enumerate}
It comes equipped with canonical hommorphisms of differential graded
$\mathcal{A}$-modules $i : \mathcal{L} \to C(f)$
and $p : C(f) \to \mathcal{K}[1]$ induced by the obvious maps.
\end{definition}

\noindent
Observe that in the situation of the definition the sequence
$$
0 \to \mathcal{L} \to C(f) \to \mathcal{K}[1] \to 0
$$
is an addmissible short exact sequence.

\begin{lemma}
\label{lemma-axiom-C}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
The differential graded category
$\textit{Mod}^{dg}(\mathcal{A}, \text{d})$
satisfies axiom (C) formulated in
Differential Graded Algebra, Situation \ref{dga-situation-ABC}.
\end{lemma}

\begin{proof}
Let $f : \mathcal{K} \to \mathcal{L}$
be a homomorphism of differential graded $\mathcal{A}$-modules.
By the above we have an admissible short exact sequence
$$
0 \to \mathcal{L} \to C(f) \to \mathcal{K}[1] \to 0
$$
To finish the proof we have to show that the boundary map
$$
\delta : \mathcal{K}[1] \to \mathcal{L}[1]
$$
associated to this (see discussion above) is equal to $f[1]$.
For the section $s : \mathcal{K}[1] \to C(f)$ we use in degree
$n$ the embeddding $\mathcal{K}^{n + 1} \to C(f)^n$. Then
in degree $n$ the map $\pi$ is given by the projections
$C(f)^n \to \mathcal{L}^n$. Then finally we have to compute
$$
\delta = \pi \circ \text{d}_{C(f)} \circ s
$$
(see discussion above). In matrix notation this is equal to
$$
\left(
\begin{matrix}
1 & 0
\end{matrix}
\right)
\left(
\begin{matrix}
\text{d}_\mathcal{L} & f \\
0 & -\text{d}_\mathcal{K}
\end{matrix}
\right)
\left(
\begin{matrix}
0 \\
1
\end{matrix}
\right) = f
$$
as desired.
\end{proof}

\noindent
At this point we know that all lemmas proved in
Differential Graded Algebra, Section \ref{dga-section-review}
are valid for the differential graded category
$\textit{Mod}^{dg}(\mathcal{A}, \text{d})$.
In particular, we have the following.

\begin{proposition}
\label{proposition-homotopy-category-triangulated}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
The homotopy category $K(\textit{Mod}(\mathcal{A}, \text{d}))$
is a triangulated category where
\begin{enumerate}
\item the shift functors are those constructed in
Section \ref{section-shift-dg},
\item the distinghuished triangles are those triangles
in $K(\textit{Mod}(\mathcal{A}, \text{d}))$ which are
isomorphic as a triangle to a triangle
$$
\mathcal{K} \to \mathcal{L} \to \mathcal{N}
\xrightarrow{\delta} \mathcal{K}[1],\quad\quad
\delta = \pi \circ \text{d}_\mathcal{L} \circ s
$$
constructed from an admissible short exact sequence
$0 \to \mathcal{K} \to \mathcal{L} \to \mathcal{N} \to 0$
in $\textit{Mod}(\mathcal{A}, \text{d})$ above.
\end{enumerate}
\end{proposition}

\begin{proof}
Recall that $K(\textit{Mod}(\mathcal{A}, \text{d})) =
K(\textit{Mod}^{dg}(\mathcal{A}, \text{d}))$, see
Section \ref{section-homotopy}.
Having said this, the proposition
follows from Lemmas \ref{lemma-axioms-AB} and \ref{lemma-axiom-C}
and
Differential Graded Algebra, Proposition
\ref{dga-proposition-ABC-homotopy-category-triangulated}.
\end{proof}

\begin{remark}
\label{remark-cone-identity}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $C = C(\text{id}_\mathcal{A})$
be the cone on the identity map $\mathcal{A} \to \mathcal{A}$ viewed
as a map of differential graded $\mathcal{A}$-modules.
Then
$$
\Hom_{\textit{Mod}(\mathcal{A}, \text{d})}(C, \mathcal{M}) =
\{(x, y) \in
\Gamma(\mathcal{C}, \mathcal{M}^0) \times
\Gamma(\mathcal{C}, \mathcal{M}^{-1}) \mid
x = \text{d}(y)\}
$$
where the map from left to right sends $f$ to the pair $(x, y)$
where $x$ is the image of the global section $(0, 1)$ of
$C^{-1} = \mathcal{A}^{-1} \oplus \mathcal{A}^0$ and where
$y$ is the image of the global section $(1, 0)$ of
$C^0 = \mathcal{A}^0 \oplus \mathcal{A}^1$.
\end{remark}

\begin{lemma}
\label{lemma-dgm-grothendieck-abelian}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a differential graded $\mathcal{O}$-algebra.
The category $\textit{Mod}(\mathcal{A}, \text{d})$
is a Grothendieck abelian category.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-dgm-abelian} and the definition of a Grothendieck
abelian category
(Injectives, Definition \ref{injectives-definition-grothendieck-conditions})
it suffices to
show that $\textit{Mod}(\mathcal{A}, \text{d})$
has a generator. For every object $U$ of $\mathcal{C}$ we denote
$C_U$ the cone on the identity map $\mathcal{A}_U \to \mathcal{A}_U$
as in Remark \ref{remark-cone-identity}. We claim that
$$
\mathcal{G} = \bigoplus\nolimits_{k, U} j_{U!}C_U[k]
$$
is a generator where the sum is over all objects $U$ of $\mathcal{C}$
and $k \in \mathbf{Z}$. Indeed, given a
differential graded $\mathcal{A}$-module $\mathcal{M}$
if there are no nonzero maps from $\mathcal{G}$ to $\mathcal{M}$,
then we see that for all $k$ and $U$ we have
\begin{align*}
\Hom_{\textit{Mod}(\mathcal{A})}(j_{U!}C_U[k], \mathcal{M}) \\
& =
\Hom_{\textit{Mod}(\mathcal{A}_U)}(C_U[k], \mathcal{M}|_U) \\
& =
\{(x, y) \in \mathcal{M}^{-k}(U) \times \mathcal{M}^{-k - 1}(U) \mid
x = \text{d}(y)\}
\end{align*}
is equal to zero. Hence $\mathcal{M}$ is zero.
\end{proof}











\section{Flat resolutions}
\label{section-P-resolutions}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-P-resolutions}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let us call a right differential
graded $\mathcal{A}$-module $\mathcal{P}$ {\it good}
if
\begin{enumerate}
\item the functor
$\mathcal{N} \mapsto \mathcal{P} \otimes_\mathcal{A} \mathcal{N}$
is exact on the category of graded left $\mathcal{A}$-modules,
\item if $\mathcal{N}$ is an acyclic differential graded left
$\mathcal{A}$-module, then
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N}$ is acyclic,
\item for any morphism $(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi and any differential graded $\mathcal{O}'$-algebra
$\mathcal{A}'$ and any map $\varphi : f^{-1}\mathcal{A} \to \mathcal{A}'$
of differential graded $f^{-1}\mathcal{O}_\mathcal{D}$-algebras we have
properties (1) and (2) for the pullback $f^*\mathcal{P}$
(Section \ref{section-functoriality-dg})
viewed as a differential graded $\mathcal{A}'$-module.
\end{enumerate}
The first condition means that $\mathcal{P}$ is flat as a right graded
$\mathcal{A}$-module, the second condition means that $\mathcal{P}$ is
K-flat in the sense of Spaltenstein (see
Cohomology on Sites, Section \ref{sites-cohomology-section-flat}), and
the third condition is that this holds after arbitrary base change.

\medskip\noindent
Perhaps surprisingly, there are many good modules.

\begin{lemma}
\label{lemma-supply-good}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $U \in \Ob(\mathcal{C})$.
Then $j_!\mathcal{A}_U$ is a good differential graded
$\mathcal{A}$-module.
\end{lemma}

\begin{proof}
Let $\mathcal{N}$ be a left graded $\mathcal{A}$-module.
By Lemma \ref{lemma-tensor-with-extension-by-zero} we have
$$
j_!\mathcal{A}_U \otimes_\mathcal{A} \mathcal{N} =
j_!(\mathcal{A}_U \otimes_{\mathcal{A}_U} \mathcal{N}|_U) =
j_!(\mathcal{N}_U)
$$
as graded modules.
Since both restriction to $U$ and $j_!$ are exact this proves
condition (1). The same argument works for (2) using
Lemma \ref{lemma-tensor-with-extension-by-zero-dg}.

\medskip\noindent
Consider a morphism $(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi, a differential graded $\mathcal{O}'$-algebra
$\mathcal{A}'$, and a map $\varphi : f^{-1}\mathcal{A} \to \mathcal{A}'$
of differential graded $f^{-1}\mathcal{O}$-algebras.
We have to show that
$$
f^*j_!\mathcal{A}_U =
f^{-1}j_!\mathcal{A}_U \otimes_{f^{-1}\mathcal{A}} \mathcal{A}'
$$
satisfies (1) and (2) for the ringed topos
$(\Sh(\mathcal{C}'), \mathcal{O}')$ endowed with the
sheaf of differential graded $\mathcal{O}'$-algebras
$\mathcal{A}'$. To prove this we may replace
$(\Sh(\mathcal{C}), \mathcal{O})$ and
$(\Sh(\mathcal{C}'), \mathcal{O}')$ by equivalent ringed topoi.
Thus by
Modules on Sites, Lemma
\ref{sites-modules-lemma-morphism-ringed-topoi-comes-from-morphism-ringed-sites}
we may assume that $f$ comes from a morphism of sites
$f : \mathcal{C} \to \mathcal{C}'$ given by the continuous
functor $u : \mathcal{C} \to \mathcal{C}'$.
In this case, set $U' = u(U)$ and denote
$j' : \Sh(\mathcal{C}'/U') \to \Sh(\mathcal{C}')$ the
corresponding localization morphism.
We obtain a commutative square of morphisms of ringed topoi
$$
\xymatrix{
(\Sh(\mathcal{C}'/U'), \mathcal{O}'_{U'})
\ar[rr]_{(j', (j')^\sharp)} \ar[d]_{(f', (f')^\sharp)} & &
(\Sh(\mathcal{C}'), \mathcal{O}')
\ar[d]^{(f, f^\sharp)} \\
(\Sh(\mathcal{C}/U), \mathcal{O}_U)
\ar[rr]^{(j, j^\sharp)} & &
(\Sh(\mathcal{C}), \mathcal{O}).
}
$$
and we have $f'_*(j')^{-1} = j^{-1}f_*$. See
Modules on Sites, Lemma
\ref{sites-modules-lemma-localize-morphism-ringed-sites}.
By uniqueness of adjoints we obtain
$f^{-1}j_! = j'_!(f')^{-1}$. Thus we obtain
\begin{align*}
f^*j_!\mathcal{A}_U
& =
f^{-1}j_!\mathcal{A}_U \otimes_{f^{-1}\mathcal{A}} \mathcal{A}' \\
& =
j'_!(f')^{-1}\mathcal{A}_U \otimes_{f^{-1}\mathcal{A}} \mathcal{A}' \\
& =
j'_!\left(
(f')^{-1}\mathcal{A}_U \otimes_{f^{-1}\mathcal{A}|_{U'}}
\mathcal{A}'|_{U'}\right) \\
& =
j'_!\mathcal{A}'_{U'}
\end{align*}
The first equation is the definition of the pullback of $j_!\mathcal{A}_U$
to a differential graded module over $\mathcal{A}'$.
The second equation because $f^{-1}j_! = j'_!(f')^{-1}$.
The third equation by Lemma \ref{lemma-tensor-with-extension-by-zero-dg}
applied to the ringed site $(\mathcal{C}', f^{-1}\mathcal{O})$ with
sheaf of differential graded algebras $f^{-1}\mathcal{A}$ and with
differential graded modules $(f')^{-1}\mathcal{A}_U$ on $\mathcal{C}'/U'$
and $\mathcal{A}'$ on $\mathcal{C}'$.
The fourth equation holds because of course we have
$(f')^{-1}\mathcal{A}_U = f^{-1}\mathcal{A}|_{U'}$.
Hence we see that the pullback is another module of the
same kind and we've proven conditions (1) and (2) for it above.
\end{proof}

\begin{lemma}
\label{lemma-good-admissible-ses}
et $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let
$0 \to \mathcal{P} \to \mathcal{P}' \to \mathcal{P}'' \to 0$
be an admissible short exact sequence of differential graded
$\mathcal{A}$-modules. If two-out-of-three of these modules
are good, so is the third.
\end{lemma}

\begin{proof}
For condition (1) this is immediate as the sequence is a direct sum
at the graded level. For condition (2) note that for any
left differential graded $\mathcal{A}$-module, the sequence
$$
0 \to 
\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{P}' \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{P}'' \otimes_\mathcal{A} \mathcal{N} \to 0
$$
is an admissible short exact sequence of differential graded
$\mathcal{O}$-modules (since forgetting the differential
the tensor product is just taken in the category of graded modules).
Hence if two out of three are exact as complexes of $\mathcal{O}$-modules,
so is the third. Finally, the same argument shows that given
a morphism $(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi, a differential graded $\mathcal{O}'$-algebra
$\mathcal{A}'$, and a map $\varphi : f^{-1}\mathcal{A} \to \mathcal{A}'$
of differential graded $f^{-1}\mathcal{O}$-algebras
we have that
$$
0 \to f^*\mathcal{P} \to f^*\mathcal{P}' \to f^*\mathcal{P}'' \to 0
$$
is an admissible short exact sequence of differential graded
$\mathcal{A}'$-modules and the same argument as above applies here.
\end{proof}

\begin{lemma}
\label{lemma-good-direct-sum}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. An arbitrary
direct sum of good differential graded $\mathcal{A}$-modules
is good. A filtered colimit of good differential graded
$\mathcal{A}$-modules is good. 
\end{lemma}

\begin{proof}
Omitted. Hint: direct sums and filtered colimits
commute with tensor products and with pullbacks.
\end{proof}

\begin{lemma}
\label{lemma-good-quotient}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$
be a differential graded $\mathcal{A}$-module. There exists a homomorphism
$\mathcal{P} \to \mathcal{M}$ of differential graded $\mathcal{A}$-modules
with the following properties
\begin{enumerate}
\item $\mathcal{P} \to \mathcal{M}$ is surjective,
\item $\Ker(\text{d}_\mathcal{P}) \to \Ker(\text{d}_\mathcal{M})$
is surjective, and
\item $\mathcal{P}$ is good.
\end{enumerate}
\end{lemma}

\begin{proof}
Consider triples $(U, k, x)$ where $U$ is an object of $\mathcal{C}$,
$k \in \mathbf{Z}$, and $x$ is a section of $\mathcal{M}^k$ over $U$
with $\text{d}_\mathcal{M}(x) = 0$. Then we obtain a unique morphism
of differential graded $\mathcal{A}_U$-modules
$\varphi_x : \mathcal{A}_U[-k] \to \mathcal{M}|_U$
mapping $1$ to $x$. This is adjoint to a morphism
$\psi_x : j_{U!}\mathcal{A}_U[-k] \to \mathcal{M}$.
Observe that $1 \in \mathcal{A}_U(U)$ corresponds to
a section $1 \in j_{U!}\mathcal{A}_U[-k](U)$ of degree $k$
whose differential is zero and which is mapped to $x$ by $\psi_x$.
Thus if we consider the map
$$
\bigoplus\nolimits_{(U, k, x)} j_{U!}\mathcal{A}_U[-k]
\longrightarrow
\mathcal{M}
$$
then we will have conditions (2) and (3). Namely, the objects
$j_{U!}\mathcal{A}_U[-k]$ are good (Lemma \ref{lemma-supply-good})
and any direct sum of good objects is good (Lemma \ref{lemma-good-direct-sum}).

\medskip\noindent
Next, consider triples $(U, k, x)$ where $U$ is an object of $\mathcal{C}$,
$k \in \mathbf{Z}$, and $x$ is a section of $\mathcal{M}^k$ (not necessarily
annihilated by the differential). Then we can consider
the cone $C_U$ on the identity map $\mathcal{A}_U \to \mathcal{A}_U$
as in Remark \ref{remark-cone-identity}. The element $x$ will determine a map
$\varphi_x : C_U[-k - 1] \to \mathcal{A}_U$, see
Remark \ref{remark-cone-identity}. Now, since we have
an admissible short exact sequence
$$
0 \to \mathcal{A}_U \to C_U \to \mathcal{A}_U[1] \to 0
$$
we conclude that $j_{U!}C_U$ is a good module by
Lemma \ref{lemma-good-admissible-ses} and
the already used Lemma \ref{lemma-supply-good}.
As above we conclude that the direct sum of the maps
$\psi_x : j_{U!}C_U \to \mathcal{M}$ adjoint to the $\varphi_x$
$$
\bigoplus\nolimits_{(U, k, x)} j_{U!}C_U \longrightarrow \mathcal{M}
$$
is surjective. Taking the direct sum with the map produced
in the first paragraph we conclude.
\end{proof}

\begin{remark}
\label{remark-sheaf-graded-sets}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. A
{\it sheaf of graded sets} on $\mathcal{C}$ is a sheaf
of sets $\mathcal{S}$ endowed with a map
$\deg : \mathcal{S} \to \underline{\mathbf{Z}}$
of sheaves of sets. Let us denote $\mathcal{O}[\mathcal{S}]$
the graded $\mathcal{O}$-module which is the
free $\mathcal{O}$-module on the graded sheaf of sets $\mathcal{S}$.
More precisely, the $n$th graded part of
$\mathcal{O}[\mathcal{S}]$ is the sheafification of the rule
$$
U \longmapsto
\bigoplus\nolimits_{s \in \mathcal{S}(U),\ \deg(s) = n} s \cdot \mathcal{O}(U)
$$
With zero differential we also may consider this as a
differential graded $\mathcal{O}$-module.
Let $\mathcal{A}$ be a sheaf of graded $\mathcal{O}$-algebras
Then we similarly define $\mathcal{A}[\mathcal{S}]$ to be the
graded $\mathcal{A}$-module whose $n$th graded part is the
sheafification of the rule
$$
U \longmapsto
\bigoplus\nolimits_{s \in \mathcal{S}(U)} s \cdot \mathcal{A}^{n - \deg(s)}(U)
$$
If $\mathcal{A}$ is a differential graded $\mathcal{O}$-algebra, the
we turn this into a differential graded $\mathcal{O}$-module
by setting $\text{d}(s) = 0$ for all $s \in \mathcal{S}(U)$
and sheafifying.
\end{remark}

\begin{lemma}
\label{lemma-free-graded-module-good}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a differential graded $\mathcal{A}$-algebra.
Let $\mathcal{S}$ be a sheaf of graded sets on $\mathcal{C}$.
Then the free graded module $\mathcal{A}[\mathcal{S}]$
on $\mathcal{S}$ endowed with differential as in
Remark \ref{remark-sheaf-graded-sets}
is a good differential graded $\mathcal{A}$-module.
\end{lemma}

\begin{proof}
Let $\mathcal{N}$ be a left graded $\mathcal{A}$-module.
Then we have
$$
\mathcal{A}[\mathcal{S}] \otimes_\mathcal{A} \mathcal{N} =
\mathcal{O}[\mathcal{S}] \otimes_\mathcal{O} \mathcal{N} =
\mathcal{N}[\mathcal{S}]
$$
where $\mathcal{N}[\mathcal{S}$ is the
graded $\mathcal{O}$-module whose degree $n$ part
is the sheaf associated to the presheaf
$$
U \longmapsto
\bigoplus\nolimits_{s \in \mathcal{S}(U)} s \cdot \mathcal{N}^{n - \deg(s)}(U)
$$
It is clear that $\mathcal{N} \to \mathcal{N}[\mathcal{S}]$
is an exact functor, hence $\mathcal{A}[\mathcal{S}$ is flat
as a graded $\mathcal{A}$-module. Next, suppose that $\mathcal{N}$
is a differential graded left $\mathcal{A}$-module. Then we have
$$
H^*(\mathcal{A}[\mathcal{S}] \otimes_\mathcal{A} \mathcal{N}) =
H^*(\mathcal{O}[\mathcal{S}] \otimes_\mathcal{O} \mathcal{N})
$$
as graded sheaves of $\mathcal{O}$-modules, which by the flatness
(over $\mathcal{O})$ is equal to
$$
H^*(\mathcal{N})[\mathcal{S}]
$$
as a graded $\mathcal{O}$-module. Hence if $\mathcal{N}$ is acyclic,
then $\mathcal{A}[\mathcal{S}] \otimes_\mathcal{A} \mathcal{N}$
is acyclic.

\medskip\noindent
Finally, consider a morphism
$(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi, a differential graded $\mathcal{O}'$-algebra
$\mathcal{A}'$, and a map $\varphi : f^{-1}\mathcal{A} \to \mathcal{A}'$
of differential graded $f^{-1}\mathcal{O}$-algebras.
Then it is straightforward to see that
$$
f^*\mathcal{A}[\mathcal{S}] = \mathcal{A}'[f^{-1}\mathcal{S}]
$$
which finishes the proof that our module is good.
\end{proof}

\begin{lemma}
\label{lemma-resolve}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$
be a differential graded $\mathcal{A}$-module. There exists a homomorphism
$\mathcal{P} \to \mathcal{M}$ of differential graded $\mathcal{A}$-modules
with the following properties
\begin{enumerate}
\item $\mathcal{P} \to \mathcal{M}$ is a quasi-isomorphism, and
\item $\mathcal{P}$ is good.
\end{enumerate}
\end{lemma}

\begin{proof}[First proof]
Let $\mathcal{S}_0$ be the sheaf of graded sets
(Remark \ref{remark-sheaf-graded-sets})
whose degree $n$ part is $\Ker(\text{d}_\mathcal{M}^n)$.
Consider the homomorphism of differential graded modules
$$
\mathcal{P}_0 = \mathcal{A}[\mathcal{S}_0] \longrightarrow \mathcal{M}
$$
where the left hand side is as in Remark \ref{remark-sheaf-graded-sets}
and the map sends a local section $s$ of $\mathcal{S}_0$
to the corresponding local section of $\mathcal{M}^{\deg(s)}$
(which is in the kernel of the differential, so our map is
a map of differential graded modules indeed). By construction the
induced maps on cohomology sheaves $H^n(\mathcal{P}_0) \to H^n(\mathcal{M})$
are surjective. We are going to inductively construct maps
$$
\mathcal{P}_0 \to \mathcal{P}_1 \to \mathcal{P}_2 \to \ldots \to \mathcal{M}
$$
Observe that of course $H^*(\mathcal{P}_i) \to H^*(\mathcal{M})$
will be surjective for all $i$.
Given $\mathcal{P}_i \to \mathcal{M}$ denote $\mathcal{S}_{i + 1}$
the sheaf of graded sets whose degree $n$ part is
$$
\Ker(\text{d}_{\mathcal{P}_i}^{n + 1})
\times_{\mathcal{M}^{n + 1}, \text{d}}
\mathcal{M}^n
$$
Then we set
$$
\mathcal{P}_{i + 1} = \mathcal{P}_i \oplus \mathcal{A}[\mathcal{S}_{i + 1}]
$$
as graded $\mathcal{A}$-module with differential and map to
$\mathcal{M}$ defined as follows
\begin{enumerate}
\item for local sections of $\mathcal{P}_i$ use the differential on
$\mathcal{P}_i$ and the given map to $\mathcal{M}$,
\item for a local section $s = (p, m)$ of $\mathcal{S}_{i + 1}$ we set
$\text{d}(s)$ equal to $p$ viewed as a section of $\mathcal{P}_i$
of degree $\deg(s) + 1$ and we map $s$ to $m$ in $\mathcal{M}$, and
\item extend the differential uniquely so that the Leibniz rule holds.
\end{enumerate}
This makes sense because $\text{d}(m)$ is the image of $p$ and
$\text{d}(p) = 0$.
Finally, we set $\mathcal{P} = \colim \mathcal{P}_i$ with the
induced map to $\mathcal{M}$.

\medskip\noindent
The map $\mathcal{P} \to \mathcal{M}$ is a quasi-isomorphism:
we have $H^n(\mathcal{P}) = \colim H^n(\mathcal{P}_i)$
and for each $i$ the map $H^n(\mathcal{P}_i) \to H^n(\mathcal{M})$
is surjective with kernel annihilated  by the map
$H^n(\mathcal{P}_i) \to H^n(\mathcal{P}_{i + 1})$ by construction.
Each $\mathcal{P}_i$ is good because $\mathcal{P}_0$ is good
by Lemma \ref{lemma-free-graded-module-good} and each $\mathcal{P}_{i + 1}$
is in the middle of the admissible short exact sequence
$0 \to \mathcal{P}_i \to \mathcal{P}_{i + 1} \to
\mathcal{A}[\mathcal{S}_{i + 1}] \to 0$
whose outer terms are good by induction. Hence
$\mathcal{P}_{i + 1}$ is good by
Lemma \ref{lemma-good-admissible-ses}.
Finally, we conclude that $\mathcal{P}$ is good by
Lemma \ref{lemma-good-direct-sum}.
\end{proof}

\begin{proof}[Second proof]
We urge the reader to read the proof of Differential Graded Algebra,
Lemma \ref{dga-lemma-resolve} before reading this proof.
Set $\mathcal{M} = \mathcal{M}_0$.
We inductively choose short exact sequences
$$
0 \to \mathcal{M}_{i + 1} \to \mathcal{P}_i \to \mathcal{M}_i \to 0
$$
where the maps
$\mathcal{P}_i \to \mathcal{M}_i$ are chosen as in
Lemma \ref{lemma-good-quotient}.
This gives a ``resolution''
$$
\ldots \to \mathcal{P}_2 \xrightarrow{f_2}
\mathcal{P}_1 \xrightarrow{f_1} \mathcal{P}_0 \to \mathcal{M} \to 0
$$
Then we let $\mathcal{P}$ be the differential graded
$\mathcal{A}$-module defined as follows
\begin{enumerate}
\item as a graded $\mathcal{A}$-module we set
$\mathcal{P} = \bigoplus_{a \leq 0} \mathcal{P}_{-a}[-a]$, i.e.,
the degree $n$ part is given by
$\mathcal{P}^n = \bigoplus\nolimits_{a + b = n} \mathcal{P}_{-a}^b$,
\item the differential on $\mathcal{P}$ is as in the construction of
the total complex associated to a double complex given by
$$
\text{d}_\mathcal{P}(x) = f_{-a}(x) + (-1)^a \text{d}_{\mathcal{P}_{-a}}(x)
$$
for $x$ a local section of $\mathcal{P}_{-a}^b$.
\end{enumerate}
With these conventions $\mathcal{P}$ is indeed a
differential graded $\mathcal{A}$-module; we omit the details.
There is a map $\mathcal{P} \to \mathcal{M}$ of differential graded
$\mathcal{A}$-modules which is zero on the summands $\mathcal{P}_{-a}[-a]$
for $a < 0$ and the given map $\mathcal{P}_0 \to \mathcal{M}$ for $a = 0$.
Observe that we have
$$
\mathcal{P} = \colim_i F_i\mathcal{P}
$$
where $F_i\mathcal{P} \subset \mathcal{P}$ is the differential
graded $\mathcal{A}$-submodule whose underlying graded $\mathcal{A}$-module
is
$$
F_i\mathcal{P} =
\bigoplus\nolimits_{i \geq -a \geq 0} \mathcal{P}_{-a}[-a]
$$
It is immediate that the maps
$$
0 \to F_1\mathcal{P} \to F_2\mathcal{P} \to F_3\mathcal{P} \to
\ldots \to \mathcal{P}
$$
are all admissible monomorphisms and we have admissible short exact sequences
$$
0 \to F_i\mathcal{P} \to
F_{i + 1}\mathcal{P} \to
\mathcal{P}_{i + 1}[i + 1] \to 0
$$
By induction and Lemma \ref{lemma-good-admissible-ses}
we find that $F_i\mathcal{P}$ is a good differential graded
$\mathcal{A}$-module. Since $\mathcal{P} = \colim F_i\mathcal{P}$
we find that $\mathcal{P}$ is good by Lemma \ref{lemma-good-direct-sum}.

\medskip\noindent
Finally, we have to show that $\mathcal{P} \to \mathcal{M}$
is a quasi-isomorphism. If $\mathcal{C}$ has enough points, then
this follows from the elementary
Homology, Lemma \ref{homology-lemma-good-resolution-gives-qis}
by checking on stalks. In general, we can argue as follows
(this proof is far too long --- there is an alternative argument by
working with local sections as in the elementary proof but it
is also rather long).
Since filtered colimits are exact on the category of abelian
sheaves, we have
$$
H^d(\mathcal{P}) = \colim H^d(F_i\mathcal{P})
$$
We claim that for each $i \geq 0$ and $d \in \mathbf{Z}$
we have (a) a short exact sequence
$$
0 \to H^d(\mathcal{M}_{i + 1}[i]) \to
H^d(F_i\mathcal{P}) \to H^d(\mathcal{M}) \to 0
$$
where the second arrow comes from
$F_i\mathcal{P} \to \mathcal{P} \to \mathcal{M}$
and (b) the composition
$$
H^d(\mathcal{M}_{i + 1}[i]) \to
H^d(F_i\mathcal{P}) \to
H^d(F_{i + 1}\mathcal{P})
$$
is zero. It is clear that the claim suffices to finish the proof.

\medskip\noindent
Proof of the claim. For any $i \geq 0$ there is a map
$\mathcal{M}_{i + 1}[i] \to F_i\mathcal{P}$ coming from
the inclusion of $\mathcal{M}_{i + 1}$ into $\mathcal{P}_i$
as the kernel of $f_i$. Consider the short exact sequence
$$
0 \to \mathcal{M}_{i + 1}[i] \to F_i\mathcal{P} \to C_i \to 0
$$
of complexes of $\mathcal{O}$-modules defining $C_i$.
Observe that $C_0 = \mathcal{M}_0 = \mathcal{M}$.
Also, observe that $C_i$ is the total complex associated to the
double complex $C_i^{\bullet, \bullet}$ with columns
$$
\mathcal{M}_i = \mathcal{P}_i/\mathcal{M}_{i + 1},
\mathcal{P}_{i - 1}, \ldots, \mathcal{P}_0
$$
in degree $-i, -i + 1, \ldots, 0$. There is a map of double complexes
$C_i^{\bullet, \bullet} \to C_{i - 1}^{\bullet, \bullet}$ which is
$0$ on the column in degree $-i$, is the surjection
$\mathcal{P}_{i - 1} \to \mathcal{M}_{i - 1}$ in degree $-i + 1$,
and is the identity on the other columns.
Hence there are maps of complexes
$$
C_i \longrightarrow C_{i - 1}
$$
These maps are surjective quasi-isomorphisms because the kernel
is the total complex on the double complex with columns
$\mathcal{M}_i, \mathcal{M}_i$ in degrees $-i, -i + 1$ and
the identity map between these two columns. Using the
resulting identifications
$H^d(C_i) = H^d(C_{i - 1} = \ldots = H^d(\mathcal{M})$
this already shows we get a long exact sequence
$$
H^d(\mathcal{M}_{i + 1}[i]) \to
H^d(F_i\mathcal{P}) \to H^d(\mathcal{M}) \to
H^{d + 1}(\mathcal{M}_{i + 1}[i])
$$
from the short exact sequence of complexes above.
However, we also have the commutative diagram
$$
\xymatrix{
\mathcal{M}_{i + 2}[i + 1] \ar[r]_a & T_{i + 1} \ar[r] &
F_{i + 1}\mathcal{P} \ar[r] & C_{i + 1} \ar[d] \\
& \mathcal{M}_{i + 1}[i] \ar[r] \ar[u]^b &
F_i\mathcal{P} \ar[u] \ar[r] &
C_i
}
$$
where $T_{i + 1}$ is the total complex on the double complex
with columns $\mathcal{P}_{i + 1}, \mathcal{M}_{i + 1}$ placed
in degrees $-i - 1$ and $-i$. In other words, $T_{i + 1}$ is
a shift of the cone on the map
$\mathcal{P}_{i + 1} \to \mathcal{M}_{i + 1}$ and we find that
$a$ is a quasi-isomorphism and the map $a^{-1} \circ b$ is a shift of the
third map of the distinguished triangle in $D(\mathcal{O})$ associated
to the short exact sequence
$$
0 \to \mathcal{M}_{i + 2} \to \mathcal{P}_{i + 1} \to \mathcal{M}_{i + 1} \to 0
$$
The map $H^d(\mathcal{P}_{i + 1}) \to H^d(\mathcal{M}_{i + 1})$
is surjective because we chose our maps such that
$\Ker(\text{d}_{\mathcal{P}_{i + 1}}) \to
\Ker(\text{d}_{\mathcal{M}_{i + 1}})$ is surjective.
Thus we see that $a^{-1} \circ b$ is zero on cohomology sheaves.
This proves part (b) of the claim.
Since $T_{i + 1}$ is the kernel of the surjective map of complexes
$F_{i + 1}\mathcal{P} \to C_i$ we find a map of long exact
cohomology sequences
$$
\xymatrix{
H^d(T_{i + 1}) \ar[r] &
H^d(F_{i + 1}\mathcal{P}) \ar[r] &
H^d(\mathcal{M}) \ar[r] &
H^{d + 1}(T_{i + 1}) \\
H^d(\mathcal{M}_{i + 1}[i]) \ar[r] \ar[u] &
H^d(F_i\mathcal{P}) \ar[r] \ar[u] &
H^d(\mathcal{M}) \ar[r] \ar[u] &
H^{d + 1}(\mathcal{M}_{i + 1}[i]) \ar[u]
}
$$
Here we know, by the discussion above, that the vertical maps
on the outside are zero. Hence the maps
$H^d(F_{i + 1}\mathcal{P}) \to H^d(\mathcal{M})$
are surjective and part (a) of the claim follows.
More precisely, the claim follows for $i > 0$ and we leave the
claim for $i = 0$ to the reader (actually it suffices to prove
the claim for all $i \gg 0$ in order to get the lemma).
\end{proof}

\begin{lemma}
\label{lemma-acyclic-good}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\mathcal{P}$ be a good
acyclic right differential graded $\mathcal{A}$-module.
\begin{enumerate}
\item for any differential graded left $\mathcal{A}$-module
$\mathcal{N}$ the tensor product
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N}$ is acyclic,
\item for any morphism $(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi and any differential graded $\mathcal{O}'$-algebra
$\mathcal{A}'$ and any map $\varphi : f^{-1}\mathcal{A} \to \mathcal{A}'$
of differential graded $f^{-1}\mathcal{O}$-algebras
the pullback $f^*\mathcal{P}$ is acyclic and good.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). By Lemma \ref{lemma-resolve} we can choose a good
left differential graded $\mathcal{Q}$ and a quasi-isomorphism
$\mathcal{Q} \to \mathcal{N}$. Then
$\mathcal{P} \otimes_\mathcal{A} \mathcal{Q}$
is acyclic because $\mathcal{Q}$ is good.
Let $\mathcal{N}'$ be the cone on the map
$\mathcal{Q} \to \mathcal{N}$. Then
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N}'$ is acyclic because
$\mathcal{P}$ is good and because $\mathcal{N}'$ is acyclic
(as the cone on a quasi-isomorphism). We have a distinguished
triangle
$$
\mathcal{Q} \to \mathcal{N} \to \mathcal{N}' \to \mathcal{Q}[1]
$$
in $K(\textit{Mod}(\mathcal{A}, \text{d}))$ by our construction
of the triangulated structure. Since
$\mathcal{P} \otimes_\mathcal{A} -$ sends distinguished
triangles to distinguished triangles, we obtain a distinguished
triangle
$$
\mathcal{P} \otimes_\mathcal{A} \mathcal{Q} \to
\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}' \to
\mathcal{P} \otimes_\mathcal{A} \mathcal{Q}[1]
$$
in $K(\textit{Mod}(\mathcal{O}))$. Thus we conclude.

\medskip\noindent
Proof of (2). Observe that $f^*\mathcal{P}$ is good by our definition
of good modules. Recall that
$f^*\mathcal{P} = f^{-1}\mathcal{P} \otimes_{f^{-1}\mathcal{A}} \mathcal{A}'$.
Then $f^{-1}\mathcal{P}$ is a good acyclic (because $f^{-1}$ is exact)
differential graded $f^{-1}\mathcal{A}$-module. Hence
we see that $f^*\mathcal{P}$ is acyclic by part (1).
\end{proof}






\section{The differential graded hull of a graded module}
\label{section-dg-hull}

\noindent
The differential graded hull of a graded module $\mathcal{N}$ is
the result of applying the functor $G$ in the following lemma.

\begin{lemma}
\label{lemma-dg-hull}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. The forgetful functor
$F : \textit{Mod}(\mathcal{A}, \text{d}) \to \textit{Mod}(\mathcal{A})$
has a left adjoint $G : \textit{Mod}(\mathcal{A}) \to
\textit{Mod}(\mathcal{A}, \text{d})$.
\end{lemma}

\begin{proof}
To prove the existence of $G$ we can use the adjoint functor theorem, see
Categories, Theorem \ref{categories-theorem-adjoint-functor} (observe that
we have switched the roles of $F$ and $G$). The exactness conditions on
$F$ are satisfied by Lemma \ref{lemma-dgm-abelian}. The set theoretic
condition can be seen as follows: suppose given a graded $\mathcal{A}$-module
$\mathcal{N}$. Then for any map
$$
\varphi : \mathcal{N} \longrightarrow F(\mathcal{M})
$$
we can consider the smallest differential graded $\mathcal{A}$-submodule
$\mathcal{M}' \subset \mathcal{M}$ with
$\Im(\varphi) \subset F(\mathcal{M}')$.
It is clear that $\mathcal{M}'$ is the image of the map
of graded $\mathcal{A}$-modules
$$
\mathcal{N} \oplus
\mathcal{N}[-1] \otimes_\mathcal{O} \mathcal{A}
\longrightarrow
\mathcal{M}
$$
defined by
$$
(n, \sum n_i \otimes a_i) \longmapsto
\varphi(n) + \sum \text{d}(\varphi(n_i)) a_i
$$
because the image of this map is easily seen to be a differential graded
submodule of $\mathcal{M}$.
Thus the number of possible isomorphism classes of these $\mathcal{M}'$
is bounded and we conclude.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\mathcal{M}$ be a differential
graded $\mathcal{A}$-module and suppose we have a short exact sequence
$$
0 \to \mathcal{N} \to F(\mathcal{M}) \to \mathcal{N}' \to 0
$$
in $\textit{Mod}(\mathcal{A})$. Then we obtain a canonical
graded $\mathcal{A}$-module homomorphism
$$
\overline{\text{d}} : \mathcal{N} \to \mathcal{N}'[1]
$$
as follows: given a local section $x$ of $\mathcal{N}$ denote
$\overline{\text{d}}(x)$ the image in $\mathcal{N}'$ of
$\text{d}_\mathcal{M}(x)$ when $x$ is viewed as a local section
of $\mathcal{M}$.

\begin{lemma}
\label{lemma-dg-hull-acyclic}
The functors $F, G$ of Lemma \ref{lemma-dg-hull} have
the following properties. Given a graded $\mathcal{A}$-module
$\mathcal{N}$ we have
\begin{enumerate}
\item the counit $\mathcal{N} \to F(G(\mathcal{N}))$ is injective,
\item the map $\overline{\text{d}} : \mathcal{N} \to
\Coker(\mathcal{N} \to F(G(\mathcal{N})))[1]$ is an isomorphism, and
\item $G(\mathcal{N})$ is an acyclic differential graded $\mathcal{A}$-module.
\end{enumerate}
\end{lemma}

\begin{proof}
We observe that property (3) is a consequence of properties (1) and (2).
Namely, if $s$ is a nonzero local section of $F(G(\mathcal{N}))$
with $\text{d}(s) = 0$, then $s$ cannot be in the image of
$\mathcal{N} \to F(G(\mathcal{N}))$. Hence we can write the image
$\overline{s}$ of $s$ in the cokernel as
$\overline{\text{d}}(s')$ for some local section $s'$ of $\mathcal{N}$.
Then we see that $s = \text{d}(s')$ because the difference
$s - \text{d}(s')$ is still in the kernel of $\text{d}$
and is contained in the image of the counit.

\medskip\noindent
Let us write temporarily $\mathcal{A}_{gr}$, respectively $\mathcal{A}_{dg}$
the sheaf $\mathcal{A}$ viewed as a (right) graded module over itself,
respectively as a (right) differential graded module over itself.
The most important case of the lemma is to understand what
is $G(\mathcal{A}_{gr})$. Of course $G(\mathcal{A}_{gr})$ is the object
of $\textit{Mod}(\mathcal{A}, \text{d})$ representing the
functor
$$
\mathcal{M} \longmapsto
\Hom_{\textit{Mod}(\mathcal{A})}(\mathcal{A}_{gr}, F(\mathcal{M})) =
\Gamma(\mathcal{C}, \mathcal{M})
$$
By Remark \ref{remark-cone-identity} we see that this functor represented
by $C[-1]$ where $C$ is the cone on the identity of $\mathcal{A}_{dg}$.
We have a short exact sequence
$$
0 \to \mathcal{A}_{dg}[-1] \to C[-1] \to \mathcal{A}_{dg} \to 0
$$
in $\textit{Mod}(\mathcal{A}, \text{d})$ which is split by the
counit $\mathcal{A}_{gr} \to F(C[-1])$ in $\textit{Mod}(\mathcal{A})$.
Thus $G(\mathcal{A}_{gr})$ satisfies properties (1) and (2).

\medskip\noindent
Let $U$ be an object of $\mathcal{C}$. Denote
$j_U : \mathcal{C}/U \to \mathcal{C}$ the localization morphism.
Denote $\mathcal{A}_U$ the restriction of $\mathcal{A}$ to $U$.
We will use the notation $\mathcal{A}_{U, gr}$ to denote
$\mathcal{A}_U$ viewed as a graded $\mathcal{A}_U$-module.
Denote $F_U : \textit{Mod}(\mathcal{A}_U, \text{d}) \to
\textit{Mod}(\mathcal{A}_U)$ the forgetful functor and denote
$G_U$ its adjoint. Then we have the commutative diagrams
$$
\vcenter{
\xymatrix{
\textit{Mod}(\mathcal{A}, \text{d}) \ar[d]_{j_U^*} \ar[r]_F &
\textit{Mod}(\mathcal{A}) \ar[d]^{j_U^*} \\
\textit{Mod}(\mathcal{A}_U, \text{d}) \ar[r]^{F_U} &
\textit{Mod}(\mathcal{A}_U)
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
\textit{Mod}(\mathcal{A}_U, \text{d}) \ar[r]_{F_U} \ar[d]_{j_{U!}} &
\textit{Mod}(\mathcal{A}_U) \ar[d]^{j_{U!}} \\
\textit{Mod}(\mathcal{A}, \text{d}) \ar[r]^F &
\textit{Mod}(\mathcal{A})
}
}
$$
by the construction of $j^*_U$ and $j_{U!}$ in
Sections \ref{section-functoriality-graded},
\ref{section-functoriality-dg},
\ref{section-localize-graded}, and
\ref{section-localize-dg}.
By uniqueness of adjoints we obtain $j_{U!} \circ G_U = G \circ j_{U!}$.
Since $j_{U!}$ is an exact functor, we see that the properties
(1) and (2) for the counit
$\mathcal{A}_{U, gr} \to F_U(G_U(\mathcal{A}_{U, gr}))$
which we've seen in the previous part of the proof
imply properties (1) and (2) for the counit
$j_{U!}\mathcal{A}_{U, gr} \to F(G(j_{U!}\mathcal{A}_{U, gr})) =
j_{U!}F_U(G_U(\mathcal{A}_{U, gr}))$.

\medskip\noindent
In the proof of Lemma \ref{lemma-gm-grothendieck-abelian}
we have seen that any object
of $\textit{Mod}(\mathcal{A})$ is a quotient of a direct sum
of copies of $j_{U!}\mathcal{A}_{U, gr}$. Since $G$ is a left
adjoint, we see that $G$ commutes with direct sums. Thus
properties (1) and (2) hold for direct sums of objects
for which they hold. Thus we see that every object $\mathcal{N}$
of $\textit{Mod}(\mathcal{A})$ fits into an exact sequence
$$
\mathcal{N}_1 \to \mathcal{N}_0 \to \mathcal{N} \to 0
$$
such that (1) and (2) hold for $\mathcal{N}_1$ and $\mathcal{N}_0$.
We leave it to the reader to deduce (1) and (2) for
$\mathcal{N}$ using that $G$ is right exact.
\end{proof}









\section{K-injective differential graded modules}
\label{section-K-injective}

\noindent
This section is the analogue of
Injectives, Section \ref{injectives-section-K-injective}
in the setting of sheaves of differential graded modules
over a sheaf of differential graded algebras.

\begin{lemma}
\label{lemma-characterize-injectives}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let $\mathcal{A}$
be a sheaf of graded algebras on $(\mathcal{C}, \mathcal{O})$.
There exists a set $T$ and for each $t \in T$ an injective map
$\mathcal{N}_t \to \mathcal{N}'_t$ of graded $\mathcal{A}$-modules
such that an object $\mathcal{I}$ of $\textit{Mod}(\mathcal{A})$
is injective if and only if for every solid diagram
$$
\xymatrix{
\mathcal{N}_t \ar[r] \ar[d] & \mathcal{I} \\
\mathcal{N}'_t \ar@{..>}[ru]
}
$$
a dotted arrow exists in $\textit{Mod}(\mathcal{A})$ making the diagram commute.
\end{lemma}

\begin{proof}
This is true in any Grothendieck abelian category, see
Injectives, Lemma \ref{injectives-lemma-characterize-injective}.
By Lemma \ref{lemma-gm-grothendieck-abelian} the category
$\textit{Mod}(\mathcal{A})$ is a Grothendieck abelian category.
\end{proof}

\begin{definition}
\label{definition-graded-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. A diffential graded $\mathcal{A}$-module
$\mathcal{I}$ is said to be {\it graded injective}\footnote{This may be
nonstandard terminology.} if $\mathcal{M}$ viewed as a graded
$\mathcal{A}$-module is an injective object of the category
$\textit{Mod}(\mathcal{A})$ of graded $\mathcal{A}$-modules.
\end{definition}

\begin{remark}
\label{remark-why-graded-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\mathcal{I}$ be a graded injective
diffential graded $\mathcal{A}$-module. Let
$$
0 \to \mathcal{M}_1 \to \mathcal{M}_2 \to \mathcal{M}_3 \to 0
$$
be a short exact sequence of differential graded $\mathcal{A}$-modules.
Since $\mathcal{I}$ is graded injective
we obtain a short exact sequence of complexes
$$
0 \to
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{M}_3, \mathcal{I})
\to
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{M}_2, \mathcal{I})
\to
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{M}_1, \mathcal{I})
\to 0
$$
of $\Gamma(\mathcal{C}, \mathcal{O})$-modules. Taking cohomology we
obtain a long exact sequence
$$
\xymatrix{
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_3, \mathcal{I})
\ar[d] &
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_3, \mathcal{I})[1]
\ar[d] \\
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_2, \mathcal{I})
\ar[d] &
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_2, \mathcal{I})[1]
\ar[d] \\
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_1, \mathcal{I})
\ar[ruu]
&
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}_1, \mathcal{I})[1]
}
$$
of groups of homomorphisms in the homotopy category. The point is that
we get this even though we didn't assume that our short exact sequence
is admissible (so the short exact sequence in general does not define
a distinguished triangle in the homotopy category).
\end{remark}

\begin{lemma}
\label{lemma-product-graded-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $T$ be a set and for
each $t \in T$ let $\mathcal{I}_t$ be a graded injective
diffential graded $\mathcal{A}$-module. Then
$\prod \mathcal{I}_t$ is a graded injective differential
graded $\mathcal{A}$-module.
\end{lemma}

\begin{proof}
This is true because products of injectives are injectives, see
Homology, Lemma \ref{homology-lemma-product-injectives}, and
because products in
$\textit{Mod}(\mathcal{A}, \text{d})$ are compatible with
products in $\textit{Mod}(\mathcal{A})$ via the forgetful functor.
\end{proof}

\begin{lemma}
\label{lemma-characterize-graded-injectives-in-dg}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
There exists a set $T$ and for each $t \in T$ an injective map
$\mathcal{M}_t \to \mathcal{M}'_t$ of
acyclic differential graded $\mathcal{A}$-modules
such that for an object $\mathcal{I}$ of $\textit{Mod}(\mathcal{A}, \text{d})$
the following are equivalent
\begin{enumerate}
\item $\mathcal{I}$ is graded injective, and
\item for every solid diagram
$$
\xymatrix{
\mathcal{M}_t \ar[r] \ar[d] & \mathcal{I} \\
\mathcal{M}'_t \ar@{..>}[ru]
}
$$
a dotted arrow exists in $\textit{Mod}(\mathcal{A}, \text{d})$
making the diagram commute.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $T$ and $\mathcal{N}_t \to \mathcal{N}'_t$ be as in
Lemma \ref{lemma-characterize-injectives}.
Denote $F : \textit{Mod}(\mathcal{A}, \text{d}) \to \textit{Mod}(\mathcal{A})$
the forgetful functor.
Let $G$ be the left adjoint functor to
$F$ as in Lemma \ref{lemma-dg-hull}. Set
$$
\mathcal{M}_t = G(\mathcal{N}_t) \to
G(\mathcal{N}'_t) = \mathcal{M}'_t
$$
This is an injective map of acyclic differential graded
$\mathcal{A}$-modules by Lemma \ref{lemma-dg-hull-acyclic}.
Since $G$ is the left adjoint to $F$ we see that
there exists a dotted arrow in the diagram
$$
\xymatrix{
\mathcal{M}_t \ar[r] \ar[d] & \mathcal{I} \\
\mathcal{M}'_t \ar@{..>}[ru]
}
$$
if and only if there exists a dotted arrow in the diagram
$$
\xymatrix{
\mathcal{N}_t \ar[r] \ar[d] & F(\mathcal{I}) \\
\mathcal{N}'_t \ar@{..>}[ru]
}
$$
Hence the result follows from the choice of our
collection of arrows $\mathcal{N}_t \to \mathcal{N}_t'$.
\end{proof}


\begin{lemma}
\label{lemma-small-acyclics}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. There exists a set $S$ and for each $s$
an acyclic differential graded $\mathcal{A}$-module $\mathcal{M}_s$ such
that for every nonzero acyclic differential graded $\mathcal{A}$-module
$\mathcal{M}$ there is an $s \in S$ and an injective map
$\mathcal{M}_s \to \mathcal{M}$ in $\textit{Mod}(\mathcal{A}, \text{d})$.
\end{lemma}

\begin{proof}
Before we start recall that our conventions guarantee the site $\mathcal{C}$
has a set of objects and morphisms and a set $\text{Cov}(\mathcal{C})$
of coverings.
If $\mathcal{F}$
is a differential graded $\mathcal{A}$-module, let us define $|\mathcal{F}|$
to be the sum of the cardinality of
$$
\coprod\nolimits_{(U, n)} \mathcal{F}^n(U)
$$
as $U$ ranges over the objects of $\mathcal{C}$ and $n \in \mathbf{Z}$.
Choose an infinite cardinal $\kappa$ bigger than
the cardinals $|\Ob(\mathcal{C})|$, $|\text{Arrows}(\mathcal{C})|$,
$|\text{Cov}(\mathcal{C})|$, $\sup |I|$ for
$\{U_i \to U\}_{i \in I} \in \text{Cov}(\mathcal{C})$,
and $|\mathcal{A}|$.

\medskip\noindent
Let $\mathcal{F} \subset \mathcal{M}$ be an inclusion of
differential graded $\mathcal{A}$-modules.
Suppose given a set $K$ and for each $k \in K$ a triple
$(U_k, n_k, x_k)$ consisting of an object $U_k$ of $\mathcal{C}$,
integer $n_k$, and a section $x_k \in \mathcal{M}^{n_k}(U_k)$.
Then we can consider the smallest differential graded
$\mathcal{A}$-submodule $\mathcal{F}' \subset \mathcal{M}$
containing $\mathcal{F}$ and the sections $x_k$ for $k \in K$.
We can describe
$$
(\mathcal{F}')^n(U) \subset \mathcal{M}^n(U)
$$
as the set of elements $x \in \mathcal{M}^n(U)$ such that there
exists $\{f_i : U_i \to U\}_{i \in I} \in \text{Cov}(\mathcal{C})$ such that
for each $i \in I$ there is a finite set $T_i$ and morphisms
$g_t : U_i \to U_{k_t}$
$$
f_i^*x = y_i +
\sum\nolimits_{t \in T_i} a_{it}g_t^*x_{k_t} + b_{it}g_t^*\text{d}(x_{k_t})
$$
for some section $y_i \in \mathcal{F}^n(U)$ and
sections $a_{it} \in \mathcal{A}^{n - n_{k_t}}(U_i)$
and $b_{it} \in \mathcal{A}^{n - n_{k_t} - 1}(U_i)$.
(Details omitted; hints: these sections are certainly in $\mathcal{F}'$
and you show conversely that this rule defines a differential
graded $\mathcal{A}$-submodule.)
It follows from this description that
$|\mathcal{F}'| \leq \max(|\mathcal{F}|, |K|, \kappa)$.

\medskip\noindent
Let $\mathcal{M}$ be a nonzero acyclic differential graded
$\mathcal{A}$-module. Then we can find an integer $n$ and a
nonzero section $x$ of $\mathcal{M}^n$ over some object $U$
of $\mathcal{C}$. Let
$$
\mathcal{F}_0 \subset \mathcal{M}
$$
be the smallest differential graded $\mathcal{A}$-submodule
containing $x$. By the previous paragraph we have
$|\mathcal{F}_0| \leq \kappa$. By induction, given
$\mathcal{F}_0, \ldots, \mathcal{F}_n$ define
$\mathcal{F}_{n + 1}$ as follows. Consider the set
$$
L = \{(U, n, x)\}
\{U_i \to U\}_{i \in I}, (x_i)_{i \in I})\}
$$
of triples where $U$ is an object of $\mathcal{C}$, $n \in \mathbf{Z}$,
and $x \in \mathcal{F}_n(U)$ with $\text{d}(x) = 0$. Since
$\mathcal{M}$ is acyclic for each triple $l = (U_l, n_l, x_l) \in L$
we can choose
$\{(U_{l, i} \to U_l\}_{i \in I_l} \in \text{Cov}(\mathcal{C})$ and
$x_{l, i} \in \mathcal{M}^{n_l - 1}(U_{l, i})$ such that
$\text{d}(x_{l, i}) = x|_{U_{l, i}}$. Then we set
$$
K = \{(U_{l, i}, n_l - 1, x_{l, i}) \mid l \in L, i \in I_l\}
$$
and we let $\mathcal{F}_{n + 1}$ be the smallest differential
graded $\mathcal{A}$-submodule of $\mathcal{M}$ containing
$\mathcal{F}_n$ and the sections $x_{l, i}$.
Since $|K| \leq \max(\kappa, |\mathcal{F}_n|)$
we conclude that $|\mathcal{F}_{n + 1}| \leq \kappa$ by induction.

\medskip\noindent
By construction the inclusion $\mathcal{F}_n \to \mathcal{F}_{n + 1}$
induces the zero map on cohomology sheaves. Hence we see that
$\mathcal{F} = \bigcup \mathcal{F}_n$ is a nonzero acyclic submodule
with $|\mathcal{F}| \leq \kappa$. Since there is only a set
of isomorphism classes of differential graded $\mathcal{A}$-modules
$\mathcal{F}$ with $|\mathcal{F}|$ bounded, we conclude.
\end{proof}

\begin{definition}
\label{definition-K-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. A diffential graded $\mathcal{A}$-module
$\mathcal{I}$ is {\it K-injective} if for every acyclic
differential graded $\mathcal{M}$ we have 
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}, \mathcal{I}) = 0
$$
\end{definition}

\noindent
Please note the similarity with
Derived Categories, Definition \ref{derived-definition-K-injective}.

\begin{lemma}
\label{lemma-product-K-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $T$ be a set and for
each $t \in T$ let $\mathcal{I}_t$ be a K-injective
diffential graded $\mathcal{A}$-module. Then
$\prod \mathcal{I}_t$ is a K-injective differential
graded $\mathcal{A}$-module.
\end{lemma}

\begin{proof}
Let $\mathcal{K}$ be an acyclic differential graded $\mathcal{A}$-module.
Then we have
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{K},
\prod\nolimits_{t \in T} \mathcal{I}_t)
=
\prod\nolimits_{t \in T}
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}(\mathcal{K}, \mathcal{I}_t)
$$
because taking products in $\textit{Mod}(\mathcal{A}, \text{d})$
commutes with the forgetful functor to graded $\mathcal{A}$-modules.
Since taking products is an exact functor on the category of abelian groups
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-first-property-dg-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{I}$ be a K-injective and graded injective
object of $\textit{Mod}(\mathcal{A}, \text{d})$.
For every solid diagram in $\textit{Mod}(\mathcal{A}, \text{d})$
$$
\xymatrix{
\mathcal{M} \ar[r]_a \ar[d]_b & \mathcal{I} \\
\mathcal{M}' \ar@{..>}[ru]
}
$$
where $b$ is injective and $\mathcal{M}$ is acyclic
a dotted arrow exists making the diagram commute.
\end{lemma}

\begin{proof}
Since $\mathcal{M}$ is acyclic and $\mathcal{I}$ is K-injective,
there exists a graded $\mathcal{A}$-module map
$h : \mathcal{M} \to \mathcal{I}$ of degree $-1$
such that $a = \text{d}(h)$. Since $\mathcal{I}$ is graded injective
and $b$ is injective, there exists a graded $\mathcal{A}$-module
map $h' : \mathcal{M}' \to \mathcal{I}$ of degree $-1$
such that $h = h' \circ b$. Then we can take $a' = \text{d}(h')$
as the dotted arrow.
\end{proof}

\begin{lemma}
\label{lemma-second-property-dg-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Let $\mathcal{I}$ be a
K-injective and graded injective
object of $\textit{Mod}(\mathcal{A}, \text{d})$.
For every solid diagram in $\textit{Mod}(\mathcal{A}, \text{d})$
$$
\xymatrix{
\mathcal{M} \ar[r]_a \ar[d]_b & \mathcal{I} \\
\mathcal{M}' \ar@{..>}[ru]
}
$$
where $b$ is a quasi-isomorphism a dotted arrow exists making the
diagram commute up to homotopy.
\end{lemma}

\begin{proof}
After replacing $\mathcal{M}'$ by the direct sum of $\mathcal{M}'$
and the cone on the identity on $\mathcal{M}$ (which is acyclic)
we may assume $b$ is also injective. Then the cokernel $\mathcal{Q}$
of $b$ is acyclic. Thus we see that
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{Q}, \mathcal{I}) =
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{Q}, \mathcal{I})[1] = 0
$$
as $\mathcal{I}$ is K-injective. As $\mathcal{I}$ is graded injective
by Remark \ref{remark-why-graded-injective}
we see that
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}', \mathcal{I})
\longrightarrow
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}, \mathcal{I})
$$
is bijective and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-better-set-of-monos}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
There exists a set $R$ and for each $r \in R$ an injective map
$\mathcal{M}_r \to \mathcal{M}'_r$ of
acyclic differential graded $\mathcal{A}$-modules
such that for an object $\mathcal{I}$ of $\textit{Mod}(\mathcal{A}, \text{d})$
the following are equivalent
\begin{enumerate}
\item $\mathcal{I}$ is K-injective and graded injective, and
\item for every solid diagram
$$
\xymatrix{
\mathcal{M}_r \ar[r] \ar[d] & \mathcal{I} \\
\mathcal{M}'_r \ar@{..>}[ru]
}
$$
a dotted arrow exists in $\textit{Mod}(\mathcal{A}, \text{d})$
making the diagram commute.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $T$ and $\mathcal{M}_t \to \mathcal{M}'_t$ be as in
Lemma \ref{lemma-characterize-graded-injectives-in-dg}.
Let $S$ and $\mathcal{M}_s$ be as in
Lemma \ref{lemma-small-acyclics}.
Choose an injective map $\mathcal{M}_s \to \mathcal{M}'_s$
of acyclic differential graded $\mathcal{A}$-modules
which is homotopic to zero. This is possible because we
may take $\mathcal{M}'_s$ to be the cone on the identity;
in that case it is even true that the identity on
$\mathcal{M}'_s$ is homotopic to zero, see
Differential Graded Algebra, Lemma \ref{dga-lemma-id-cone-null} which
applies by the discussion in Section \ref{section-conclude-triangulated}.
We claim that $R = T \coprod S$ with the given maps works.

\medskip\noindent
The implication (1) $\Rightarrow$ (2) holds by
Lemma \ref{lemma-first-property-dg-injective}.

\medskip\noindent
Assume (2). First, by Lemma \ref{lemma-characterize-graded-injectives-in-dg}
we see that $\mathcal{I}$ is graded injective. Next, let
$\mathcal{M}$ be an acyclic differential graded $\mathcal{A}$-module.
We have to show that
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}, \mathcal{I}) = 0
$$
The proof will be exactly the same as the proof of
Injectives, Lemma \ref{injectives-lemma-characterize-K-injective}.

\medskip\noindent
We are going to construct by induction on the ordinal $\alpha$
an acyclic differential graded submodule
$\mathcal{K}_\alpha \subset \mathcal{M}$ as follows.
For $\alpha = 0$ we set $\mathcal{K}_0 = 0$. For $\alpha > 0$
we proceed as follows:
\begin{enumerate}
\item If $\alpha = \beta + 1$ and $\mathcal{K}_\beta = \mathcal{M}$
then we choose $\mathcal{K}_\alpha = \mathcal{K}_\beta$.
\item If $\alpha = \beta + 1$ and $\mathcal{K}_\beta \not = \mathcal{M}$
then $\mathcal{M}/\mathcal{K}_\beta$ is a nonzero acyclic
differential graded $\mathcal{A}$-module.
We choose a differential graded $\mathcal{A}$ submodule
$\mathcal{N}_\alpha \subset \mathcal{M}/\mathcal{K}_\beta$
isomorphic to $\mathcal{M}_s$ for some $s \in S$, see
Lemma \ref{lemma-small-acyclics}.
Finally, we let $\mathcal{K}_\alpha \subset \mathcal{M}$
be the inverse image of $\mathcal{N}_\alpha$.
\item If $\alpha$ is a limit ordinal we set
$\mathcal{K}_\beta = \colim \mathcal{K}_\alpha$.
\end{enumerate}
It is clear that $\mathcal{M} = \mathcal{K}_\alpha$ for a suitably large
ordinal $\alpha$. We will prove that
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{K}_\alpha, \mathcal{I})
$$
is zero by transfinite induction on $\alpha$. It holds for $\alpha = 0$
since $\mathcal{K}_0$ is zero. Suppose it holds for $\beta$ and
$\alpha = \beta + 1$. In case (1) of the list above the result is clear.
In case (2) there is a short exact sequence
$$
0 \to \mathcal{K}_\beta \to \mathcal{K}_\alpha \to \mathcal{N}_\alpha \to 0
$$
By Remark \ref{remark-why-graded-injective}
and since we've seen that $\mathcal{I}$ is graded
injective, we obtain an exact sequence
$$
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{K}_\beta, \mathcal{I})
\to
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{K}_\alpha, \mathcal{I})
\to
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{N}_\alpha, \mathcal{I})
$$
By induction the term on the left is zero. By assumption (2)
the term on the right is zero: any map $\mathcal{M}_s \to \mathcal{I}$
factors through $\mathcal{M}'_s$ and hence is homotopic to zero.
Thus the middle group is zero too. Finally, suppose that $\alpha$ is a
limit ordinal. Because we also have
$\mathcal{K}_\alpha = \colim \mathcal{K}_\alpha$ as graded
$\mathcal{A}$-modules we see that
$$
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}
(\mathcal{K}_\alpha, \mathcal{I})
= \lim_{\beta < \alpha}
\Hom_{\textit{Mod}^{dg}(\mathcal{A}, \text{d})}
(\mathcal{K}_\beta, \mathcal{I})
$$
as complexes of abelian groups. The cohomology groups of these
complexes compute morphisms in $K(\textit{Mod}(\mathcal{A}, \text{d}))$
between shifts. The transition maps in the system of complexes
are surjective by Remark \ref{remark-why-graded-injective}
because $\mathcal{I}$ is graded injective.
Moreover, for a limit ordinal $\beta \leq \alpha$
we have equality of limit and value. Thus we may apply
Homology, Lemma \ref{homology-lemma-ML-over-ordinals}
to conclude.
\end{proof}

\begin{lemma}
\label{lemma-functor-set-of-monos}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
Let $R$ be a set and for each $r \in R$ let an injective map
$\mathcal{M}_r \to \mathcal{M}'_r$ of
acyclic differential graded $\mathcal{A}$-modules be given.
There exists a functor $M : \textit{Mod}(\mathcal{A}, \text{d}) \to
\textit{Mod}(\mathcal{A}, \text{d})$ and a natural transformation
$j : \text{id} \to M$ such that
\begin{enumerate}
\item $j_\mathcal{M} : \mathcal{M} \to M(\mathcal{M})$ is injective
and a quasi-isomorphism,
\item for every solid diagram
$$
\xymatrix{
\mathcal{M}_r \ar[r] \ar[d] & \mathcal{M} \ar[d]^{j_\mathcal{M}} \\
\mathcal{M}'_r \ar@{..>}[r] & M(\mathcal{M})
}
$$
a dotted arrow exists in $\textit{Mod}(\mathcal{A}, \text{d})$
making the diagram commute.
\end{enumerate}
\end{lemma}

\begin{proof}
We define $M(\mathcal{M})$ as the pushout in the following diagram
$$
\xymatrix{
\bigoplus_{(r, \varphi)} \mathcal{M}_r \ar[r] \ar[d] &
\mathcal{M} \ar[d] \\
\bigoplus_{(r, \varphi)} \mathcal{M}'_r \ar[r] &
M(\mathcal{M})
}
$$
where the direct sum is over all pairs $(r, \varphi)$
with $r \in R$ and $\varphi \in
\Hom_{\textit{Mod}(\mathcal{A}, \text{d})}(\mathcal{M}_r, \mathcal{M})$.
Since the pushout of an injective map is injective, we see that
$\mathcal{M} \to M(\mathcal{M})$ is injective.
Since the cokernel of the left vertical arrow is acyclic,
we see that the (isomorphic) cokernel of $\mathcal{M} \to M(\mathcal{M})$
is acyclic, hence $\mathcal{M} \to M(\mathcal{M})$
is a quasi-isomorphism. Property (2) holds by construction.
We omit the verification that
this procedure can be turned into a functor.
\end{proof}

\begin{theorem}
\label{theorem-qis-into-dg-injective}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$
be a sheaf of differential graded algebras on $(\mathcal{C}, \mathcal{O})$.
For every differential graded $\mathcal{A}$-module $\mathcal{M}$ there
exists a quasi-isomorphism $\mathcal{M} \to \mathcal{I}$
where $\mathcal{I}$ is a graded injective and K-injective
differential graded $\mathcal{A}$-module. Moreover, the
construction is functorial in $\mathcal{M}$.
\end{theorem}

\begin{proof}
Let $R$ and $\mathcal{M}_r \to \mathcal{M}'_r$ be a set of
morphisms of $\textit{Mod}(\mathcal{A}, \text{d})$ found in
Lemma \ref{lemma-better-set-of-monos}.
Let $M$ with transformation $\text{id} \to M$
be as constructed in Lemma \ref{lemma-functor-set-of-monos}
using $R$ and $\mathcal{M}_r \to \mathcal{M}'_r$.
Using transfinite recursion we define a sequence of functors
$M_\alpha$ and natural transformations $M_\beta \to M_\alpha$
for $\alpha < \beta$ by setting
\begin{enumerate}
\item $M_0 = \text{id}$,
\item $M_{\alpha + 1} = M \circ M_\alpha$ with natural transformation
$M_\beta \to M_{\alpha + 1}$ for $\beta < \alpha + 1$
coming from the already constructed $M_\beta \to M_\alpha$ and the
maps $M_\alpha \to M \circ M_\alpha$ coming from $\text{id} \to M$, and
\item $M_\alpha = \colim_{\beta < \alpha} M_\beta$ if $\alpha$
is a limit ordinal with the coprojections as transformations
$M_\beta \to M_\alpha$ for $\alpha < \beta$.
\end{enumerate}
Observe that for every differential graded $\mathcal{A}$-module the maps
$\mathcal{M} \to M_\beta(\mathcal{M}) \to M_\alpha(\mathcal{M})$
are injective quasi-isomorphisms (as filtered colimits are exact).

\medskip\noindent
Recall that $\textit{Mod}(\mathcal{A}, \text{d})$ is a Grothendieck
abelian category. Thus by
Injectives, Proposition \ref{injectives-proposition-objects-are-small}
(applied to the direct sum of $\mathcal{M}_r$ for all $r \in R$)
there is a limit ordinal $\alpha$ such that $\mathcal{M}_r$ is $\alpha$-small
with respect to injections for every $r \in R$.
We claim that $\mathcal{M} \to M_\alpha(\mathcal{M})$ is
the desired functorial embedding of $\mathcal{M}$ into a
graded injective K-injective module.

\medskip\noindent
Namely, any map $\mathcal{M}_r \to M_\alpha(\mathcal{M})$
factors through $M_\beta(\mathcal{M})$ for some $\beta < \alpha$.
However, by the construction of $M$ we see that this means
that $\mathcal{M}_r \to M_{\beta + 1}(\mathcal{M}) = M(M_\beta(\mathcal{M}))$
factors through $\mathcal{M}'_r$. Since
$M_\beta(\mathcal{M}) \subset  M_{\beta + 1}(\mathcal{M})
\subset M_\alpha(\mathcal{M})$ we get the desired factorizaton
into $M_\alpha(\mathcal{M})$. We conclude by our choice of
$R$ and $\mathcal{M}_r \to \mathcal{M}'_r$ in
Lemma \ref{lemma-better-set-of-monos}.
\end{proof}










\section{The derived category}
\label{section-derived}

\noindent
This section is the analogue of Differential Graded Algebra, Section
\ref{dga-section-derived}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. We will construct the derived
category $D(\mathcal{A}, \text{d})$ by inverting the quasi-isomorphisms
in $K(\textit{Mod}(\mathcal{A}, \text{d}))$.

\begin{lemma}
\label{lemma-cohomology-homological}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. The functor 
$H^0 : \textit{Mod}(\mathcal{A}, \text{d}) \to \textit{Mod}(\mathcal{O})$
of Section \ref{section-modules} factors through a
functor
$$
H^0 : K(\textit{Mod}(\mathcal{A}, \text{d})) \to \textit{Mod}(\mathcal{O})
$$
which is homological in the sense of
Derived Categories, Definition \ref{derived-definition-homological}.
\end{lemma}

\begin{proof}
It follows immediately from the definitions that there is
a commutative diagram
$$
\xymatrix{
\textit{Mod}(\mathcal{A}, \text{d}) \ar[r] \ar[d] &
K(\textit{Mod}(\mathcal{A}, \text{d})) \ar[d] \\
\text{Comp}(\mathcal{O}) \ar[r] &
K(\textit{Mod}(\mathcal{O}))
}
$$
Since $H^0(\mathcal{M})$ is defined as the zeroth cohomology
sheaf of the underlying complex of $\mathcal{O}$-modules of $\mathcal{M}$
the lemma follows from the case of complexes of $\mathcal{O}$-modules
which is a special case of
Derived Categories, Lemma \ref{derived-lemma-cohomology-homological}.
\end{proof}

\begin{lemma}
\label{lemma-acyclics}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. The full subcategory $\text{Ac}$
of the homotopy category $K(\textit{Mod}(\mathcal{A}, \text{d}))$
consisting of acyclic modules is a strictly full saturated
triangulated subcategory of $K(\textit{Mod}(\mathcal{A}, \text{d}))$.
\end{lemma}

\begin{proof}
Of course an object $\mathcal{M}$ of $K(\textit{Mod}(\mathcal{A}, \text{d}))$
is in $\text{Ac}$ if and only if $H^i(\mathcal{M}) = H^0(\mathcal{M}[i])$
is zero for all $i$. The lemma follows from this,
Lemma \ref{lemma-cohomology-homological}, and
Derived Categories, Lemma \ref{derived-lemma-homological-functor-kernel}.
See also Derived Categories, Definitions \ref{derived-definition-saturated}
and \ref{derived-definition-triangulated-subcategory} and
Lemma \ref{derived-lemma-triangulated-subcategory}.
\end{proof}

\begin{lemma}
\label{lemma-qis}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Consider the subclass
$\text{Qis} \subset \text{Arrows}(K(\textit{Mod}(\mathcal{A}, \text{d})))$
consisting of quasi-isomorphisms. This is a saturated multiplicative
system compatible with the triangulated structure on
$K(\textit{Mod}(\mathcal{A}, \text{d}))$.
\end{lemma}

\begin{proof}
Observe that if $f , g : \mathcal{M} \to \mathcal{N}$ are morphisms
of $\textit{Mod}(\mathcal{A}, \text{d})$ which are homotopic,
then $f$ is a quasi-isomorphism if and only if $g$ is a quasi-isomorphism.
Namely, the maps $H^i(f) = H^0(f[i])$ and $H^i(g) = H^0(g[i])$ are
the same by Lemma \ref{lemma-cohomology-homological}. Thus it is
unambiguous to say that a morphism of the homotopy category
$K(\textit{Mod}(\mathcal{A}, \text{d}))$ is a quasi-isomorphism.
For definitions of ``multiplicative system'', ``saturated'', and
``compatible with the triangulated structure'' see
Derived Categories, Definition \ref{derived-definition-localization}
and
Categories, Definitions \ref{categories-definition-multiplicative-system}
and \ref{categories-definition-saturated-multiplicative-system}.

\medskip\noindent
To actually prove the lemma consider the composition
of exact functors of triangulated categories
$$
K(\textit{Mod}(\mathcal{A}, \text{d}))
\longrightarrow
K(\textit{Mod}(\mathcal{O}))
\longrightarrow
D(\mathcal{O})
$$
and observe that a morphism $f : \mathcal{M} \to \mathcal{N}$
of $K(\textit{Mod}(\mathcal{A}, \text{d}))$ is in $\text{Qis}$
if and only if it maps to an isomorphism in $D(\mathcal{O})$.
Thus the lemma follows from Derived Categories, Lemma
\ref{derived-lemma-triangle-functor-localize}.
\end{proof}

\noindent
In the situation of Lemma \ref{lemma-qis} we can apply
Derived Categories, Proposition
\ref{derived-proposition-construct-localization}
to obtain an exact functor of triangulated categories
$$
Q :
K(\textit{Mod}(\mathcal{A}, \text{d}))
\longrightarrow
\text{Qis}^{-1}K(\textit{Mod}(\mathcal{A}, \text{d}))
$$
However, as $\textit{Mod}(\mathcal{A}, \text{d})$ is a ``big''
category, i.e., its objects form a proper class, it isn't immediately
clear that given $\mathcal{M}$ and $\mathcal{N}$ the construction
of $\text{Qis}^{-1}K(\textit{Mod}(\mathcal{A}, \text{d}))$
produces a {\it set}
$$
\Mor_{\text{Qis}^{-1}K(\textit{Mod}(\mathcal{A}, \text{d}))}
(\mathcal{M}, \mathcal{N})
$$
of morphisms. However, this is true thanks to our construction of
K-injective complexes. Namely, by Theorem \ref{theorem-qis-into-dg-injective}
we can choose a quasi-isomorphism $s_0 : \mathcal{N} \to \mathcal{I}$ where
$\mathcal{I}$ is a graded injective and K-injective
differential graded $\mathcal{A}$-module. Next, recall that elements of
the displayed set are equivalence classes of pairs
$(f : \mathcal{M} \to \mathcal{N}', s : \mathcal{N} \to \mathcal{N}')$
where $f$ is an arbitrary morphism of
$K(\textit{Mod}(\mathcal{A}, \text{d}))$ and $s$ is a quasi-isomorphsm, see
the description of the left calculus of fractions in
Categories, Section \ref{categories-section-localization}.
By Lemma \ref{lemma-second-property-dg-injective}
we can choose the dotted arrow
$$
\xymatrix{
\mathcal{M} \ar[rd]^f & &
\mathcal{N} \ar[ld]_s \ar[rd]^{s_0} \\
& \mathcal{N}' \ar@{..>}[rr]^{s'} & & \mathcal{I}
}
$$
making the diagram commute (in the homotopy category).
Thus the pair $(f, s)$ is equivalent to the pair $(s' \circ f, s_0)$
and we find that the collection of equivalence classes forms a set.

\begin{definition}
\label{definition-derived-category}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let $\text{Qis}$ be as in
Lemma \ref{lemma-qis}. The
{\it derived category of $(\mathcal{A}, \text{d})$} is the triangulated
category
$$
D(\mathcal{A}, \text{d}) =
\text{Qis}^{-1}K(\textit{Mod}(\mathcal{A}, \text{d}))
$$
discussed in more detail above.
\end{definition}

\noindent
We prove some facts about this construction.

\begin{lemma}
\label{lemma-kernel-localization}
In Definition \ref{definition-derived-category}
the kernel of the localization functor
$Q : K(\textit{Mod}(\mathcal{A}, \text{d})) \to D(\mathcal{A}, \text{d})$
is the category $\text{Ac}$ of Lemma \ref{lemma-acyclics}.
\end{lemma}

\begin{proof}
This is immediate from
Derived Categories, Lemma \ref{derived-lemma-kernel-localization}
and the fact that $0 \to \mathcal{M}$ is a quasi-isomorphism
if and only if $\mathcal{M}$ is acyclic.
\end{proof}

\begin{lemma}
\label{lemma-H0-over-D}
In Definition \ref{definition-derived-category} the functor
$H^0 : K(\textit{Mod}(\mathcal{A}, \text{d})) \to
\textit{Mod}(\mathcal{O})$ factors through a homological functor
$H^0 : D(\mathcal{A}, \text{d}) \to \textit{Mod}(\mathcal{O})$.
\end{lemma}

\begin{proof}
Follows immediately from
Derived Categories, Lemma \ref{derived-lemma-universal-property-localization}.
\end{proof}

\noindent
Here is the promised lemma computing morphism sets in the
derived category.

\begin{lemma}
\label{lemma-hom-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Let $\mathcal{M}$ and $\mathcal{N}$ be differential graded
$\mathcal{A}$-modules. Let $\mathcal{N} \to \mathcal{I}$ be a
quasi-isomorphism with $\mathcal{I}$ a graded injective and
K-injective differential graded $\mathcal{A}$-module. Then
$$
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{N}) =
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}, \mathcal{I})
$$
\end{lemma}

\begin{proof}
Since $\mathcal{N} \to \mathcal{I}$ is a quasi-isomorphism
we see that
$$
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{N}) =
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{I})
$$
In the discussion preceding Definition \ref{definition-derived-category}
we found, using Lemma \ref{lemma-second-property-dg-injective},
that any morphism $\mathcal{M} \to \mathcal{I}$
in $D(\mathcal{A}, \text{d})$ can be represented by a morphism
$f : \mathcal{M} \to \mathcal{I}$ in
$K(\textit{Mod}(\mathcal{A}, \text{d}))$.
Now, if $f, f' :  \mathcal{M} \to \mathcal{I}$ are two morphism in
$K(\textit{Mod}(\mathcal{A}, \text{d}))$, then they define
the same morphism in $D(\mathcal{A}, \text{d})$ if and only
if there exists a quasi-isomorphism $g : \mathcal{I} \to \mathcal{K}$
in $K(\textit{Mod}(\mathcal{A}, \text{d}))$
such that $g \circ f = g \circ f'$, see
Categories, Lemma \ref{categories-lemma-equality-morphisms-left-localization}.
However, by Lemma \ref{lemma-second-property-dg-injective} there
exists a map
$h : \mathcal{K} \to \mathcal{I}$
such that $h \circ g = \text{id}_\mathcal{I}$ in
in $K(\textit{Mod}(\mathcal{A}, \text{d}))$.
Thus $g \circ f = g \circ f'$ implies $f = f'$ and
the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-derived-products}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Then
\begin{enumerate}
\item $D(\mathcal{A}, \text{d})$ has both direct sums and products,
\item direct sums are obtained by taking direct sums of differential graded
$\mathcal{A}$-modules,
\item products are obtained by taking products of
K-injective differential graded modules.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use that $\textit{Mod}(\mathcal{A}, \text{d})$ is an abelian category
with arbitrary direct sums and products, and that these give rise
to direct sums and products in $K(\textit{Mod}(\mathcal{A}, \text{d}))$.
See Lemmas \ref{lemma-dgm-abelian} and \ref{lemma-homotopy-direct-sums}.

\medskip\noindent
Let $\mathcal{M}_j$ be a family of differential graded $\mathcal{A}$-modules.
Consider the direct sum $\mathcal{M} = \bigoplus \mathcal{M}_j$
as a differential graded $\mathcal{A}$-module.
For a differential graded $\mathcal{A}$-module
$\mathcal{N}$ choose a quasi-isomorphism
$\mathcal{N} \to \mathcal{I}$ where
$\mathcal{I}$ is graded injective and K-injective as a
differential graded $\mathcal{A}$-module. See
Theorem \ref{theorem-qis-into-dg-injective}.
Using Lemma \ref{lemma-hom-derived} we have
\begin{align*}
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{N})
& =
\Hom_{K(\mathcal{A}, \text{d})}(\mathcal{M}, \mathcal{I}) \\
& =
\prod \Hom_{K(\mathcal{A}, \text{d})}(\mathcal{M}_j, \mathcal{I}) \\
& =
\prod \Hom_{D(\mathcal{A}, \text{d})}(\mathcal{M}_j, \mathcal{I})
\end{align*}
whence the existence of direct sums in $D(A, \text{d})$ as given in
part (2) of the lemma.

\medskip\noindent
Let $\mathcal{M}_j$ be a family of differential graded $\mathcal{A}$-modules.
For each $j$ choose a quasi-isomorphism
$\mathcal{M} \to \mathcal{I}_j$ where
$\mathcal{I}_j$ is graded injective and K-injective as a
differential graded $\mathcal{A}$-module.
Consider the product $\mathcal{I} = \prod \mathcal{I}_j$
of differential graded $\mathcal{A}$-modules.
By Lemmas \ref{lemma-product-K-injective} and
\ref{lemma-product-graded-injective} we see that
$\mathcal{I}$ is graded injective and K-injective as a
differential graded $\mathcal{A}$-module.
For a differential graded $\mathcal{A}$-module
$\mathcal{N}$ using Lemma \ref{lemma-hom-derived} we have
\begin{align*}
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{N}, \mathcal{I})
& =
\Hom_{K(\mathcal{A}, \text{d})}(\mathcal{N}, \mathcal{I}) \\
& =
\prod \Hom_{K(\mathcal{A}, \text{d})}(\mathcal{N}, \mathcal{I}_j) \\
& =
\prod \Hom_{D(\mathcal{A}, \text{d})}(\mathcal{N}, \mathcal{M}_j)
\end{align*}
whence the existence of products in $D(\mathcal{A}, \text{d})$ as given in
part (3) of the lemma.
\end{proof}







\section{The canonical delta-functor}
\label{section-canonical-delta-functor}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$.
Consider the functor
$\textit{Mod}(\mathcal{A}, \text{d}) \to
K(\textit{Mod}(\mathcal{A}, \text{d}))$.
This functor is {\bf not} a $\delta$-functor in general.
However, it turns out that the functor
$\textit{Mod}(\mathcal{A}, \text{d}) \to D(A, \text{d})$ is a
$\delta$-functor. In order to see this we have to define
the morphisms $\delta$ associated to a short exact sequence
$$
0 \to \mathcal{K} \xrightarrow{a} \mathcal{L} \xrightarrow{b} \mathcal{M} \to 0
$$
in the abelian category $\textit{Mod}(\mathcal{A}, \text{d})$.
Consider the cone $C(a)$ of the morphism $a$ together with its
canonical morphisms $i : \mathcal{L} \to C(a)$ and
$p : C(a) \to \mathcal{K}[1]$, see Definition \ref{definition-cone}.
There is a homomorphism of differential graded $\mathcal{A}$-modules
$$
q : C(a) \longrightarrow \mathcal{M}
$$
by Differential Graded Algebra, Lemma \ref{dga-lemma-cone}
(which we may use by the discussion in
Section \ref{section-conclude-triangulated})
applied to the diagram
$$
\xymatrix{
\mathcal{K} \ar[r]_a \ar[d] &
\mathcal{L} \ar[d]^b \\
0 \ar[r] &
\mathcal{M}
}
$$
The map $q$ is a quasi-isomorphism for example because this is true in
the category of morphisms of complexes of $\mathcal{O}$-modules, see
discussion in
Derived Categories, Section \ref{derived-section-canonical-delta-functor}.
According to Differential Graded Algebra, Lemma \ref{dga-lemma-cone-homotopy}
(which we may use by the discussion in
Section \ref{section-conclude-triangulated})
the triangle
$$
(\mathcal{K}, \mathcal{L}, C(a), a, i, -p)
$$
is a distinguished triangle in $K(\textit{Mod}(\mathcal{A}, \text{d}))$.
As the localization functor
$K(\textit{Mod}(\mathcal{A}, \text{d})) \to D(\mathcal{A}, \text{d})$ is
exact we see that $(\mathcal{K}, \mathcal{L}, C(a), a, i, -p)$
is a distinguished
triangle in $D(\mathcal{A}, \text{d})$. Since $q$ is a quasi-isomorphism
we see that $q$ is an isomorphism in $D(\mathcal{A}, \text{d})$.
Hence we deduce that
$$
(\mathcal{K}, \mathcal{L}, \mathcal{M}, a, b, -p \circ q^{-1})
$$
is a distinguished triangle of $D(\mathcal{A}, \text{d})$.
This suggests the following lemma.

\begin{lemma}
\label{lemma-derived-canonical-delta-functor}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. The localization functor
$\textit{Mod}(\mathcal{A}, \text{d}) \to D(\mathcal{A}, \text{d})$
has the natural structure of a $\delta$-functor, with
$$
\delta_{\mathcal{K} \to \mathcal{L} \to \mathcal{M}} = - p \circ q^{-1}
$$
with $p$ and $q$ as explained above.
\end{lemma}

\begin{proof}
We have already seen that this choice leads to a distinguished
triangle whenever given a short exact sequence of complexes.
We have to show functoriality of this construction, see
Derived Categories, Definition \ref{derived-definition-delta-functor}.
This follows from Differential Graded Algebra, Lemma \ref{dga-lemma-cone}
(which we may use by the discussion in
Section \ref{section-conclude-triangulated}) with a bit of
work. Compare with
Derived Categories, Lemma \ref{derived-lemma-derived-canonical-delta-functor}.
\end{proof}

\begin{lemma}
\label{lemma-homotopy-colimit}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras
on $(\mathcal{C}, \mathcal{O})$. Let
$\mathcal{M}_n$ be a system of differential graded $\mathcal{A}$-modules.
Then the derived colimit $\text{hocolim} \mathcal{M}_n$ in
$D(\mathcal{A}, \text{d})$ is represented
by the differential graded module $\colim \mathcal{M}_n$.
\end{lemma}

\begin{proof}
Set $\mathcal{M} = \colim \mathcal{M}_n$.
We have an exact sequence of differential graded $\mathcal{A}$-modules
$$
0 \to \bigoplus \mathcal{M}_n \to \bigoplus \mathcal{M}_n \to \mathcal{M} \to 0
$$
by Derived Categories, Lemma \ref{derived-lemma-compute-colimit}
(applied the underlying complexes of $\mathcal{O}$-modules).
The direct sums are direct sums in $D(\mathcal{A}, \text{d})$ by
Lemma \ref{lemma-derived-products}.
Thus the result follows from the definition
of derived colimits in Derived Categories,
Definition \ref{derived-definition-derived-colimit}
and the fact that a short exact sequence of complexes
gives a distinguished triangle
(Lemma \ref{lemma-derived-canonical-delta-functor}).
\end{proof}






\section{Derived pullback}
\label{section-derived-pullback}

\noindent
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra.
Suppose we are given a map
$$
\varphi : f^{-1}\mathcal{B} \to \mathcal{A}
$$
of differential graded $f^{-1}\mathcal{O}_\mathcal{D}$-algebras.
By the adjunction of restriction and extension of scalars, this
is the same thing as a map $\varphi : f^*\mathcal{B} \to \mathcal{A}$
of differential graded $\mathcal{O}_\mathcal{C}$-algebras or equivalently
$\varphi$ can be viewed as a map
$$
\varphi : \mathcal{B} \to f_*\mathcal{A}
$$
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
See Remark \ref{remark-functoriality-dga}.

\medskip\noindent
In addition to the above, let $\mathcal{A}'$ be a second differential
graded $\mathcal{O}_\mathcal{C}$-algebra and let $\mathcal{N}$
be a differential graded $(\mathcal{A}, \mathcal{A}')$-bimodule.
In this setting we can consider the functor
$$
\textit{Mod}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}(\mathcal{A}', \text{d}),\quad
\mathcal{M} \longmapsto f^*\mathcal{M} \otimes_{\mathcal{A}} \mathcal{N}
$$
Observe that this extends to a functor
$$
\textit{Mod}^{dg}(\mathcal{B}, \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{A}', \text{d}),\quad
\mathcal{M} \longmapsto f^*\mathcal{M} \otimes_{\mathcal{A}} \mathcal{N}
$$
of differential graded categories by the discussion in
Sections \ref{section-functoriality-dg} and \ref{section-dg-bimodules}.
It follows formally that we also obtain an exact functor
\begin{equation}
\label{equation-pullback}
K(\textit{Mod}(\mathcal{B}, \text{d}))
\longrightarrow
K(\textit{Mod}(\mathcal{A}', \text{d})),\quad
\mathcal{M} \longmapsto f^*\mathcal{M} \otimes_{\mathcal{A}} \mathcal{N}
\end{equation}
of triangulated categories.

\begin{lemma}
\label{lemma-derived-tensor-product}
In the situation above, the functor (\ref{equation-pullback})
composed with the localization functor
$K(\textit{Mod}(\mathcal{A}', \text{d})) \to D(\mathcal{A}', \text{d})$
has a left derived extension
$D(\mathcal{B}, \text{d}) \to D(\mathcal{A}', \text{d})$ whose
value on a good right differential graded $\mathcal{B}$-module
$\mathcal{P}$ is $f^*\mathcal{P} \otimes_\mathcal{A} \mathcal{N}$.
\end{lemma}

\begin{proof}
Recall that for any (right) differential graded $\mathcal{B}$-module
$\mathcal{M}$ there exists a quasi-isomorphism $\mathcal{P} \to \mathcal{M}$
with $\mathcal{P}$ a good differential graded $\mathcal{B}$-module.
See Lemma \ref{lemma-resolve}.
Hence by Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
it suffices to show that given a quasi-isomorphism
$\mathcal{P} \to \mathcal{P}'$ of good differential graded
$\mathcal{B}$-modules the induced map
$$
f^*\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\longrightarrow
f^*\mathcal{P}' \otimes_\mathcal{A} \mathcal{N}
$$
is a quasi-isomorphism. The cone $\mathcal{P}''$ on
$\mathcal{P} \to \mathcal{P}'$ is a good differential graded
$\mathcal{A}$-module by Lemma \ref{lemma-good-admissible-ses}.
Since we have a distinguished triangle
$$
\mathcal{P} \to \mathcal{P}' \to \mathcal{P}'' \to \mathcal{P}[1]
$$
in $K(\textit{Mod}(\mathcal{B}, \text{d}))$ we obtain a distinguished
triangle
$$
f^*\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
f^*\mathcal{P}' \otimes_\mathcal{A} \mathcal{N} \to
f^*\mathcal{P}'' \otimes_\mathcal{A} \mathcal{N} \to
f^*\mathcal{P}[1] \otimes_\mathcal{A} \mathcal{N}
$$
in $K(\textit{Mod}(\mathcal{A}', \text{d}))$. By
Lemma \ref{lemma-acyclic-good}
the differential graded module
$f^*\mathcal{P}'' \otimes_\mathcal{A} \mathcal{N}$
is acyclic and the proof is complete.
\end{proof}

\begin{definition}
\label{definition-pullback}
Derived tensor product and derived pullback.
\begin{enumerate}
\item Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{B}$ be differential graded $\mathcal{O}$-algebras.
Let $\mathcal{N}$ be a  differential graded
$(\mathcal{A}, \mathcal{B})$-bimodule.
The functor $D(\mathcal{A}, \text{d}) \to D(\mathcal{B}, \text{d})$
constructed in Lemma \ref{lemma-derived-tensor-product}
is called the {\it derived tensor product} and denoted
$- \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}$.
\item Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra. Let
$\varphi : \mathcal{B} \to f_*\mathcal{A}$ be a homomorphism
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
The functor $D(\mathcal{B}, \text{d}) \to D(\mathcal{A}, \text{d})$
constructed in Lemma \ref{lemma-derived-tensor-product}
is called {\it derived pullback}
and denote $Lf^*$.
\end{enumerate}
\end{definition}

\noindent
With this language in place we can express some obvious compatibilities.

\begin{lemma}
\label{lemma-compose-pullback-tensor}
In Lemma \ref{lemma-derived-tensor-product} the functor
$D(\mathcal{B}, \text{d}) \to D(\mathcal{A}', \text{d})$ is equal to
$\mathcal{M} \mapsto
Lf^*\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}$.
\end{lemma}

\begin{proof}
Immediate from the fact that we can compute these functors
by representing objects by good differential graded modules
and because $f^*\mathcal{P}$ is a good differential graded
$\mathcal{A}$-module if $\mathcal{P}$ is a good differential
graded $\mathcal{B}$-module.
\end{proof}

\begin{lemma}
\label{lemma-compose-pullback}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O})
\to (\Sh(\mathcal{C}'), \mathcal{O}')$ and
$(g, g^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}''), \mathcal{O}'')$
be morphisms of ringed topoi. Let $\mathcal{A}$, $\mathcal{A}'$, and
$\mathcal{A}''$ be a differential graded $\mathcal{O}$-algebra,
$\mathcal{O}'$-algebra, and $\mathcal{O}''$-algebra. Let
$\varphi : \mathcal{A}' \to f_*\mathcal{A}$ and
$\varphi' : \mathcal{A}'' \to g_*\mathcal{A}'$
be a homomorphism of differential graded $\mathcal{O}'$-algebras
and $\mathcal{O}''$-algebras.
Then we have $L(g \circ f)^* = Lf^* \circ Lg^* :
D(\mathcal{A}'', \text{d}) \to D(\mathcal{A}, \text{d})$.
\end{lemma}

\begin{proof}
Immediate from the fact that we can compute these functors
by representing objects by good differential graded modules
and because $f^*\mathcal{P}$ is a good differential
graded $\mathcal{A}'$-module of $\mathcal{P}$ is a good
differential graded $\mathcal{A}$-module.
\end{proof}

\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{B}$ be differential graded $\mathcal{O}$-algebras.
Let $\mathcal{N} \to \mathcal{N}'$ be a homomorphism of differential graded
$(\mathcal{A}, \mathcal{B})$-bimodules. Then we obtain canonical
maps
$$
t :
\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}
\longrightarrow
\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}'
$$
functorial in $\mathcal{M}$ in $D(\mathcal{A}, \text{d})$
which define a natural transformation between exact functors
$D(\mathcal{A}, \text{d}) \to D(\mathcal{B}, \text{d})$
of triangulated categories. The value of $t$ on a good differential
graded $\mathcal{A}$-module $\mathcal{P}$ is the obvious map
$$
\mathcal{P} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N} =
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\longrightarrow
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}' =
\mathcal{P} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}'
$$

\begin{lemma}
\label{lemma-tensor-symmetry}
In the situation above, if $\mathcal{N} \to \mathcal{N}'$ is an isomorphism
on cohomology sheaves, then $t$ is an isomorphism of functors
$(- \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}) \to
(- \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}')$.
\end{lemma}

\begin{proof}
It is enough to show that
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}'$
is an isomorphism on cohomology sheaves for any good differential
graded $\mathcal{A}$-module $\mathcal{P}$.
To do this, let $\mathcal{N}''$ be the cone on the map
$\mathcal{N} \to \mathcal{N}'$ as a left differential graded
$\mathcal{A}$-module, see Definition \ref{definition-cone}.
(To be sure, $\mathcal{N}''$ is a bimodule too but we
don't need this.) By functoriality of the tensor construction
(it is a functor of differential graded categories)
we see that $\mathcal{P} \otimes_\mathcal{A} \mathcal{N}''$
is the cone (as a complex of $\mathcal{O}$-modules) on the map
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}'$.
Hence it suffices to show that
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N}''$
is acyclic. This follows from the fact that $\mathcal{P}$
is good and the fact that $\mathcal{N}''$ is acyclic
as a cone on a quasi-isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-good-on-other-side}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{B}$ be differential graded $\mathcal{O}$-algebras.
Let $\mathcal{N}$ be a  differential graded
$(\mathcal{A}, \mathcal{B})$-bimodule. If $\mathcal{N}$ is good
as a left differential graded $\mathcal{A}$-module, then
we have $\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{N} =
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ for all
differential graded $\mathcal{A}$-modules $\mathcal{M}$.
\end{lemma}

\begin{proof}
Let $\mathcal{P} \to \mathcal{M}$ be a quasi-isomorphism where
$\mathcal{P}$ is a good (right) differential graded $\mathcal{A}$-module.
To prove the lemma we have to show that
$\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$
is a quasi-isomorphism. The cone $C$ on the map
$\mathcal{P} \to \mathcal{M}$ is an acyclic right differential
graded $\mathcal{A}$-module. Hence
$C \otimes_\mathcal{A} \mathcal{N}$ is acyclic as $\mathcal{N}$
is assumed good as a left differential graded $\mathcal{A}$-module.
Since $C \otimes_\mathcal{A} \mathcal{N}$ is the cone on the
maps $\mathcal{P} \otimes_\mathcal{A} \mathcal{N} \to
\mathcal{M} \otimes_\mathcal{A} \mathcal{N}$ as a complex
of $\mathcal{O}$-modules we conclude.
\end{proof}

\begin{lemma}
\label{lemma-compose-tensor}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{A}'$, $\mathcal{A}''$ be differential graded
$\mathcal{O}$-algebras. Let $\mathcal{N}$ and $\mathcal{N}'$ be a
differential graded $(\mathcal{A}, \mathcal{A}')$-bimodule
and $(\mathcal{A}', \mathcal{A}'')$-bimodule. Assume
that the canonical map
$$
\mathcal{N} \otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}'
\longrightarrow
\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}'
$$
in $D(\mathcal{A}'', \text{d})$ is a quasi-isomorphism.
Then we have
$$
(\mathcal{M}
\otimes_\mathcal{A}^\mathbf{L} \mathcal{N})
\otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}'
=
\mathcal{M}
\otimes_\mathcal{A}^\mathbf{L}
(\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}')
$$
as functors $D(\mathcal{A}, \text{d}) \to D(\mathcal{A}'', \text{d})$.
\end{lemma}

\begin{proof}
Choose a good differential graded $\mathcal{A}$-module
$\mathcal{P}$ and a quasi-isomorphism $\mathcal{P} \to \mathcal{M}$, see
Lemma \ref{lemma-resolve}. Then
$$
\mathcal{M}
\otimes_\mathcal{A}^\mathbf{L}
(\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}') =
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{N}'
$$
and we have
$$
(\mathcal{M}
\otimes_\mathcal{A}^\mathbf{L} \mathcal{N})
\otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}' =
(\mathcal{P} \otimes_\mathcal{A} \mathcal{N})
\otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}'
$$
Thus we have to show the canonical map
$$
(\mathcal{P} \otimes_\mathcal{A} \mathcal{N})
\otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}'
\longrightarrow
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{N}'
$$
is a quasi-isomorphism. Choose a quasi-isomorphism
$\mathcal{Q} \to \mathcal{N}'$ where $\mathcal{Q}$
is a good left differential graded $\mathcal{A}'$-module
(Lemma \ref{lemma-resolve}).
By Lemma \ref{lemma-good-on-other-side} the map
above as a map in the derived category of $\mathcal{O}$-modules is the map
$$
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{Q}
\longrightarrow
\mathcal{P} \otimes_\mathcal{A} \mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{N}'
$$
Since $\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{Q} \to
\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}'$ is a quasi-isomorphism
by assumption and $\mathcal{P}$ is a good differential graded
$\mathcal{A}$-module this map is an quasi-isomorphism by
Lemma \ref{lemma-tensor-symmetry} (the left and right hand side
compute $\mathcal{P} \otimes_\mathcal{A}^\mathbf{L} (\mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{Q})$ and
$\mathcal{P} \otimes_\mathcal{A}^\mathbf{L} (\mathcal{N}
\otimes_{\mathcal{A}'} \mathcal{N}')$ or you can just repeat
the argument in the proof of the lemma).
\end{proof}






\section{Derived pushforward}
\label{section-derived-pushforward}

\noindent
The existence of enough K-injective guarantees that we can take the right
derived functor of any exact functor on the homotopy category.

\begin{lemma}
\label{lemma-right-derived}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded algebras on
$(\mathcal{C}, \mathcal{O})$. Then any exact functor
$$
T : K(\textit{Mod}(\mathcal{A}, \text{d})) \longrightarrow \mathcal{D}
$$
of triangulated categories has a right derived extension
$RT : D(\mathcal{A}, \text{d}) \to \mathcal{D}$
whose value on a graded injective and K-injective
differential graded $\mathcal{A}$-module $\mathcal{I}$
is $T(\mathcal{I})$.
\end{lemma}

\begin{proof}
By Theorem \ref{theorem-qis-into-dg-injective}
for any (right) differential graded $\mathcal{A}$-module
$\mathcal{M}$ there exists a quasi-isomorphism
$\mathcal{M} \to \mathcal{I}$ where $\mathcal{I}$
is a graded injective and K-injective
differential graded $\mathcal{A}$-module.
Hence by Derived Categories, Lemma \ref{derived-lemma-find-existence-computes}
it suffices to show that given a quasi-isomorphism
$\mathcal{I} \to \mathcal{I}'$ of differential graded
$\mathcal{A}$-modules which are both
graded injective and K-injective
then $T(\mathcal{I}) \to T(\mathcal{I}')$ is an isomorphism.
This is true because the map $\mathcal{I} \to \mathcal{I}'$
is an isomorphism in $K(\textit{Mod}(\mathcal{A}, \text{d}))$ as follows
for example from Lemma \ref{lemma-hom-derived} (or one can
deduce it from Lemma \ref{lemma-second-property-dg-injective}).
\end{proof}

\noindent
There are a number of functors we have already seen to which this applies.
Here are two examples.

\begin{definition}
\label{definition-pushforward}
Derived internal hom and derived pushforward.
\begin{enumerate}
\item Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{B}$ be differential graded $\mathcal{O}$-algebras.
Let $\mathcal{N}$ be a  differential graded
$(\mathcal{A}, \mathcal{B})$-bimodule. The right derived extension
$$
R\SheafHom_\mathcal{B}(\mathcal{N}, -) :
D(\mathcal{B}, \text{d})
\longrightarrow
D(\mathcal{A}, \text{d})
$$
of the internal hom functor $\SheafHom_\mathcal{B}^{dg}(\mathcal{N}, -)$
is called {\it derived internal hom}.
\item Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra. Let
$\varphi : \mathcal{B} \to f_*\mathcal{A}$ be a homomorphism
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
The right derived extension
$$
Rf_* :
D(\mathcal{A}, \text{d})
\longrightarrow
D(\mathcal{B}, \text{d})
$$
of the pushforward $f_*$ is called {\it derived pushforward}.
\end{enumerate}
\end{definition}

\noindent
It turns out that
$Rf_* : D(\mathcal{A}, \text{d}) \to D(\mathcal{B}, \text{d})$
agrees with derived pusforward on underlying complexes
of $\mathcal{O}$-modules, see Lemma \ref{lemma-pushforward-agrees}.

\medskip\noindent
These functors are the adjoints of derived pullback and
derived tensor product.

\begin{lemma}
\label{lemma-derived-adjoint-tensor-hom}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{B}$ be differential graded $\mathcal{O}$-algebras.
Let $\mathcal{N}$ be a  differential graded
$(\mathcal{A}, \mathcal{B})$-bimodule. Then
$$
R\SheafHom_\mathcal{B}(\mathcal{N}, -) :
D(\mathcal{B}, \text{d})
\longrightarrow
D(\mathcal{A}, \text{d})
$$
is right adjoint to
$$
- \otimes_\mathcal{A}^\mathbf{L} \mathcal{N} :
D(\mathcal{A}, \text{d})
\longrightarrow
D(\mathcal{B}, \text{d})
$$
\end{lemma}

\begin{proof}
This follows from Derived Categories, Lemma
\ref{derived-lemma-pre-derived-adjoint-functors-general}
and Lemma \ref{lemma-tensor-hom-adjunction-dg}.
\end{proof}

\begin{lemma}
\label{lemma-derived-adjoint-push-pull}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra. Let
$\varphi : \mathcal{B} \to f_*\mathcal{A}$ be a homomorphism
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
Then
$$
Rf_* : 
D(\mathcal{A}, \text{d})
\longrightarrow
D(\mathcal{B}, \text{d})
$$
is right adjoint to
$$
Lf^* :
D(\mathcal{B}, \text{d})
\longrightarrow
D(\mathcal{A}, \text{d})
$$
\end{lemma}

\begin{proof}
This follows from Derived Categories, Lemma
\ref{derived-lemma-pre-derived-adjoint-functors-general}
and Lemma \ref{lemma-adjunction-push-pull-dg}.
\end{proof}

\noindent
Next, we discuss what happens in the situation considered in
Section \ref{section-derived-pullback}.

\medskip\noindent
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra.
Suppose we are given a map
$$
\varphi : f^{-1}\mathcal{B} \to \mathcal{A}
$$
of differential graded $f^{-1}\mathcal{O}_\mathcal{D}$-algebras.
By the adjunction of restriction and extension of scalars, this
is the same thing as a map $\varphi : f^*\mathcal{B} \to \mathcal{A}$
of differential graded $\mathcal{O}_\mathcal{C}$-algebras or equivalently
$\varphi$ can be viewed as a map
$$
\varphi : \mathcal{B} \to f_*\mathcal{A}
$$
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
See Remark \ref{remark-functoriality-dga}.

\medskip\noindent
In addition to the above, let $\mathcal{A}'$ be a second differential
graded $\mathcal{O}_\mathcal{C}$-algebra and let $\mathcal{N}$
be a differential graded $(\mathcal{A}, \mathcal{A}')$-bimodule.
In this setting we can consider the functor
$$
\textit{Mod}(\mathcal{A}', \text{d})
\longrightarrow
\textit{Mod}(\mathcal{B}, \text{d}),\quad
\mathcal{M} \longmapsto
f_*\SheafHom^{dg}_{\mathcal{A}'}(\mathcal{N}, \mathcal{M})
$$
Observe that this extends to a functor
$$
\textit{Mod}^{dg}(\mathcal{A}', \text{d})
\longrightarrow
\textit{Mod}^{dg}(\mathcal{B}, \text{d}),\quad
\mathcal{M} \longmapsto
f_*\SheafHom^{dg}_{\mathcal{A}'}(\mathcal{N}, \mathcal{M})
$$
of differential graded categories by the discussion in
Sections \ref{section-functoriality-dg} and \ref{section-dg-bimodules}.
It follows formally that we also obtain an exact functor
\begin{equation}
\label{equation-pushforward}
K(\textit{Mod}(\mathcal{A}', \text{d}))
\longrightarrow
K(\textit{Mod}(\mathcal{B}, \text{d})),\quad
\mathcal{M} \longmapsto
f_*\SheafHom^{dg}_{\mathcal{A}'}(\mathcal{N}, \mathcal{M})
\end{equation}
of triangulated categories.

\begin{lemma}
\label{lemma-compose-pushforward-hom}
In the situation above, denote $RT : D(\mathcal{A}', \text{d}) \to
D(\mathcal{B}, \text{d})$ the right derived extension of
(\ref{equation-pushforward}). Then we have
$$
RT(\mathcal{M}) = Rf_* R\SheafHom(\mathcal{N}, \mathcal{M})
$$
functorially in $\mathcal{M}$.
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-tensor-hom-adjunction-dg} and
\ref{lemma-adjunction-push-pull-dg} the functor
(\ref{equation-pushforward}) is right adjoint to
the functor (\ref{equation-pullback}). By Derived Categories, Lemma
\ref{derived-lemma-pre-derived-adjoint-functors-general}
the functor $RT$ is right adjoint to the functor
of Lemma \ref{lemma-derived-tensor-product} which is equal to
$Lf^*(-) \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}$ by
Lemma \ref{lemma-compose-pullback-tensor}.
By Lemmas \ref{lemma-derived-adjoint-tensor-hom} and
\ref{lemma-derived-adjoint-push-pull} the functor
$Lf^*(-) \otimes_\mathcal{A}^\mathbf{L} \mathcal{N}$
is left adjoint to
$Rf_* R\SheafHom(\mathcal{N}, -)$
Thus we conclude by uniqueness of adjoints.
\end{proof}

\begin{lemma}
\label{lemma-compose-pushforward}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O})
\to (\Sh(\mathcal{C}'), \mathcal{O}')$ and
$(g, g^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}''), \mathcal{O}'')$
be morphisms of ringed topoi. Let $\mathcal{A}$, $\mathcal{A}'$, and
$\mathcal{A}''$ be a differential graded $\mathcal{O}$-algebra,
$\mathcal{O}'$-algebra, and $\mathcal{O}''$-algebra. Let
$\varphi : \mathcal{A}' \to f_*\mathcal{A}$ and
$\varphi' : \mathcal{A}'' \to g_*\mathcal{A}'$
be a homomorphism of differential graded $\mathcal{O}'$-algebras
and $\mathcal{O}''$-algebras.
Then we have $R(g \circ f)_* = Rg_* \circ Rf_* :
D(\mathcal{A}, \text{d}) \to D(\mathcal{A}'', \text{d})$.
\end{lemma}

\begin{proof}
Follows from Lemmas \ref{lemma-compose-pullback} and
\ref{lemma-derived-adjoint-push-pull}
and uniqueness of adjoints.
\end{proof}

\begin{lemma}
\label{lemma-compose-hom}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. Let
$\mathcal{A}$, $\mathcal{A}'$, $\mathcal{A}''$ be differential graded
$\mathcal{O}$-algebras. Let $\mathcal{N}$ and $\mathcal{N}'$ be a
differential graded $(\mathcal{A}, \mathcal{A}')$-bimodule
and $(\mathcal{A}', \mathcal{A}'')$-bimodule. Assume
that the canonical map
$$
\mathcal{N} \otimes_{\mathcal{A}'}^\mathbf{L} \mathcal{N}'
\longrightarrow
\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}'
$$
in $D(\mathcal{A}'', \text{d})$ is a quasi-isomorphism.
Then we have
$$
R\SheafHom_{\mathcal{A}''}
(\mathcal{N} \otimes_{\mathcal{A}'} \mathcal{N}', -)
=
R\SheafHom_{\mathcal{A}'}(\mathcal{N},
R\SheafHom_{\mathcal{A}''}(\mathcal{N}', -))
$$
as functors $D(\mathcal{A}'', \text{d}) \to D(\mathcal{A}, \text{d})$.
\end{lemma}

\begin{proof}
Follows from Lemmas \ref{lemma-compose-tensor} and
\ref{lemma-derived-adjoint-tensor-hom}
and uniqueness of adjoints.
\end{proof}

\begin{lemma}
\label{lemma-pushforward-agrees}
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O}_\mathcal{C})
\to (\Sh(\mathcal{D}), \mathcal{O}_\mathcal{D})$
be a morphism of ringed topoi. Let $\mathcal{A}$ be a differential
graded $\mathcal{O}_\mathcal{C}$-algebra. Let $\mathcal{B}$ be a
differential graded $\mathcal{O}_\mathcal{D}$-algebra. Let
$\varphi : \mathcal{B} \to f_*\mathcal{A}$ be a homomorphism
of differential graded $\mathcal{O}_\mathcal{D}$-algebras.
The diagram
$$
\xymatrix{
D(\mathcal{A}, \text{d}) \ar[d]_{Rf_*} \ar[rr]_{forget} & &
D(\mathcal{O}_\mathcal{C}) \ar[d]^{Rf_*} \\
D(\mathcal{B}, \text{d}) \ar[rr]^{forget} & &
D(\mathcal{O}_\mathcal{D})
}
$$
commutes.
\end{lemma}

\begin{proof}
Besides identifying some categories, this lemma follows immediately
from Lemma \ref{lemma-compose-pushforward}.

\medskip\noindent
We may view $(\mathcal{O}_\mathcal{C}, 0)$ as a differential graded
$\mathcal{O}_\mathcal{C}$-algebra by placing $\mathcal{O}_\mathcal{C}$
in degree $0$ and endowing it with the zero differential. It is clear
that we have
$$
\textit{Mod}(\mathcal{O}_\mathcal{C}, 0) =
\text{Comp}(\mathcal{O}_\mathcal{C})
\quad\text{and}\quad
D(\mathcal{O}_\mathcal{C}, 0) = D(\mathcal{O}_\mathcal{C})
$$
Via this identification the forgetful functor
$\textit{Mod}(\mathcal{A}, \text{d}) \to
\text{Comp}(\mathcal{O}_\mathcal{C})$
is the ``pushforward'' $\text{id}_{\mathcal{C}, *}$
defined in Section \ref{section-functoriality-dg}
corresponding to the identity morphism
$\text{id}_\mathcal{C} : (\mathcal{C}, \mathcal{O}_\mathcal{C}) \to
(\mathcal{C}, \mathcal{O}_\mathcal{C})$ of ringed topoi and the
map $(\mathcal{O}_\mathcal{C}, 0) \to (\mathcal{A}, \text{d})$
of differential graded $\mathcal{O}_\mathcal{C}$-algebras.
Since $\text{id}_{\mathcal{C}, *}$ is exact, we immediately see that
$$
R\text{id}_{\mathcal{C}, *} = forget :
D(\mathcal{A}, \text{d}) \longrightarrow
D(\mathcal{O}_\mathcal{C}, 0) = D(\mathcal{O}_\mathcal{C})
$$
The exact same reasoning shows that
$$
R\text{id}_{\mathcal{D}, *} = forget :
D(\mathcal{B}, \text{d}) \longrightarrow
D(\mathcal{O}_\mathcal{D}, 0) = D(\mathcal{O}_\mathcal{D})
$$
Moreover, the construction of
$Rf_* : D(\mathcal{O}_\mathcal{C}) \to D(\mathcal{O}_\mathcal{D})$
of Cohomology on Sites, Section \ref{sites-cohomology-section-unbounded}
agrees with the construction of
$Rf_* : D(\mathcal{O}_\mathcal{C}, 0) \to D(\mathcal{O}_\mathcal{D}, 0)$
in Definition \ref{definition-pushforward}
as both functors are defined as the right derived extension of
pushforward on underlying complexes of modules.
By Lemma \ref{lemma-compose-pushforward} we see that both
$Rf_* \circ R\text{id}_{\mathcal{C}, *}$ and
$R\text{id}_{\mathcal{D}, *} \circ Rf_*$ are the derived functors
of $f_* \circ forget = forget \circ f_*$ and hence equal
by uniqueness of adjoints.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-ext}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $\mathcal{A}$ be a differential graded $\mathcal{O}$-algebra.
Let $\mathcal{M}$ be a differential graded $\mathcal{A}$-module.
Let $n \in \mathbf{Z}$. We have
$$
H^n(\mathcal{C}, \mathcal{M}) =
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{A}, \mathcal{M}[n])
$$
where on the left hand side we have the cohomology of $\mathcal{M}$
viewed as a complex of $\mathcal{O}$-modules.
\end{lemma}

\begin{proof}
To prove the formula, observe that
$$
R\Gamma(\mathcal{C}, \mathcal{M}) = \Gamma(\mathcal{C}, \mathcal{I})
$$
where $\mathcal{M} \to \mathcal{I}$ is a quasi-isomorphism
to a graded injective and K-injective differential graded
$\mathcal{A}$-module $\mathcal{I}$ (combine
Lemmas \ref{lemma-right-derived} and \ref{lemma-pushforward-agrees}).
By Lemma \ref{lemma-hom-derived} we have
$$
\Hom_{D(\mathcal{A}, \text{d})}(\mathcal{A}, \mathcal{M}[n]) =
\Hom_{K(\textit{Mod}(\mathcal{A}, \text{d}))}(\mathcal{M}, \mathcal{I}[n]) =
H^0(\Gamma(\mathcal{C}, \mathcal{I}[n])) =
H^n(\Gamma(\mathcal{C}, \mathcal{I}))
$$
Combining these two results we obtain our equality.
\end{proof}








\section{Equivalences of derived categories}
\label{section-equivalence}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-equivalence}.

\begin{lemma}
\label{lemma-qis-equivalence}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
If $\varphi : \mathcal{A} \to \mathcal{B}$ is a homomorphism of
differential graded $\mathcal{O}$-algebras which induces an
isomorphism on cohomology sheaves, then
$$
D(\mathcal{A}, \text{d}) \longrightarrow D(\mathcal{B}, \text{d}), \quad
\mathcal{M}
\longmapsto
\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{B}
$$
is an equivalence of categories.
\end{lemma}

\begin{proof}
Recall that the restriction functor
$$
\textit{Mod}^{dg}(\mathcal{B}, \text{d}) \to
\textit{Mod}^{dg}(\mathcal{A}, \text{d}),\quad
\mathcal{N} \mapsto res_\varphi \mathcal{N}
$$
is a right adjoint to
$$
\textit{Mod}^{dg}(\mathcal{A}, \text{d}) \to
\textit{Mod}^{dg}(\mathcal{B}, \text{d}),\quad
\mathcal{M} \mapsto \mathcal{M} \otimes_\mathcal{A} \mathcal{B}
$$
See Section \ref{section-dg-bimodules}. Since restriction
sends quasi-isomorphisms to quasi-isomorphisms, we see that
it trivially has a left derived extension (given by
restriction). This functor will be right adjoint to
$- \otimes_\mathcal{A}^\mathbf{L} \mathcal{B}$ by
Derived Categories, Lemma
\ref{derived-lemma-pre-derived-adjoint-functors-general}.
The adjunction map
$$
\mathcal{M} \to
res_\varphi(\mathcal{M} \otimes_\mathcal{A}^\mathbf{L} \mathcal{B})
$$
is an isomorphism in $D(\mathcal{A}, \text{d})$ by our assumption
that $\mathcal{A} \to \mathcal{B}$ is a quasi-isomorphism of
(left) differential graded $\mathcal{A}$-modules. In particular,
the functor of the lemma is fully faithful, see
Categories, Lemma \ref{categories-lemma-adjoint-fully-faithful}.
It is clear that the kernel of the restriction functor
$D(\mathcal{B}, \text{d}) \to D(\mathcal{A}, \text{d})$
is zero. Thus we conclude by Derived Categories, Lemma
\ref{derived-lemma-fully-faithful-adjoint-kernel-zero}.
\end{proof}













\section{Resolutions of differential graded algebras}
\label{section-resolution-dgas}

\noindent
This section is the analogue of
Differential Graded Algebra, Section \ref{dga-section-resolution-dgas}.

\medskip\noindent
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site. As in
Remark \ref{remark-sheaf-graded-sets} consider a
sheaf of graded sets $\mathcal{S}$ on $\mathcal{C}$.
Let us think of the $r$-fold self product
$\mathcal{S} \times \ldots \times \mathcal{S}$
as a sheaf of graded sets with the rule
$\deg(s_1 \cdot \ldots \cdot s_r) = \sum \deg(s_i)$.
Here given local sections $s_i \in \mathcal{S}(U)$, $i = 1, \ldots, r$
we use $s_1 \cdot \ldots \cdot s_r$
to denote the corresponding section of
$\mathcal{S} \times \ldots \times \mathcal{S}$
over $U$. Let us denote $\mathcal{O}\langle \mathcal{S} \rangle$
the free graded $\mathcal{O}$-algebra on $\mathcal{S}$.
More precisely, we set
$$
\mathcal{O}\langle \mathcal{S} \rangle =
\mathcal{O} \oplus
\bigoplus\nolimits_{r \geq 1}
\mathcal{O}[\mathcal{S} \times \ldots \times \mathcal{S}]
$$
with notation as in Remark \ref{remark-sheaf-graded-sets}.
This becomes a sheaf of graded $\mathcal{O}$-algebras by
concatenation
$$
(s_1 \cdot \ldots \cdot s_r)  (s'_1 \cdot \ldots \cdot s'_{r'}) =
s_1 \cdot \ldots s_r \cdot s'_1 \cdot \ldots \cdot s'_{r'}
$$
We may endow $\mathcal{O}\langle \mathcal{S} \rangle$
with a differential by setting $\text{d}(s) = 0$
for all local sections $s$ of $\mathcal{S}$
and extending uniquely using the Leibniz rule
although it is important to also consider other differentials.

\medskip\noindent
Indeed, suppose that we are given a system of the following kind
\begin{enumerate}
\item for $i = 0, 1, 2, \ldots$ sheaves of graded sets $\mathcal{S}_i$,
\item for $i = 0, 1, 2, \ldots$ maps
$$
\delta_{i + 1} : \mathcal{S}_{i + 1}
\longrightarrow
\mathcal{A}_i =
\mathcal{O}\langle \mathcal{S}_0 \amalg \ldots \amalg \mathcal{S}_i\rangle
$$
of sheaves of graded sets of degree $1$ whose image is contained
in the kernel of the inductively defined differential on the target.
\end{enumerate}
More precisely, we first set
$\mathcal{A}_0 = \mathcal{O}\langle \mathcal{S}_0 \rangle$
and we endow it with the unique differential satisfying the Leibniz rule
where $\text{d}(s) = 0$ for any local section $s$ of $\mathcal{S}$.
By induction, assume given a differential $\text{d}$
on $\mathcal{A}_i$. Then we extend it to the unique
differential on $\mathcal{A}_{i + 1}$ satisfying the Leibniz rule and
with
$$
\text{d}(s) = \delta(s)
$$
where $\delta(s) = \delta_j(s)$ if $s$ is in the summand $\mathcal{S}_j$ of
$\mathcal{S}_0 \amalg \ldots \amalg \mathcal{S}_{i + 1}$.
This makes sense exactly because $\delta(s)$ is in the kernel
of the inductively defined differential.

\begin{lemma}
\label{lemma-special-good}
In the situation above the differential graded $\mathcal{O}$-algebra
$$
\mathcal{A} = \colim \mathcal{A}_i
$$
has the following property: for any morphism
$(f, f^\sharp) : (\Sh(\mathcal{C}'), \mathcal{O}')
\to (\Sh(\mathcal{C}), \mathcal{O})$
of ringed topoi, the pullback $f^*\mathcal{A}$
is flat as a graded $\mathcal{O}'$-module and
is K-flat as a complex of $\mathcal{O}'$-modules.
\end{lemma}

\begin{proof}
Observe that $f^*\mathcal{A} = \colim f^*\mathcal{A}_i$
and that
$$
f^*\mathcal{A}_i = \mathcal{O}'\langle
f^{-1}\mathcal{S}_0 \amalg \ldots \amalg f^{-1}\mathcal{S}_i\rangle
$$
with differential given by the inductive procedure above using
$f^{-1}\delta_{i + 1}$. Thus it suffices to prove that $\mathcal{A}$
is flat as a graded $\mathcal{O}$-module and
is K-flat as a complex of $\mathcal{O}$-modules.
For this it suffices to prove that each $\mathcal{A}_i$
is flat as a graded $\mathcal{O}$-module and
is K-flat as a complex of $\mathcal{O}$-modules, compare with
Lemma \ref{lemma-good-direct-sum}.


\medskip\noindent
For $i \geq 1$
write $\mathcal{S} = \mathcal{S}_0 \amalg \ldots \amalg \mathcal{S}_i$
so that we have $\mathcal{A}_i = \mathcal{O}\langle \mathcal{S} \rangle$
as a graded $\mathcal{O}$-algebra. We are going to construct a filtration
of this algebra by differential graded $\mathcal{O}$-submodules.

\medskip\noindent
Set $W = \mathbf{Z}_{\geq 0}^{i + 1}$ considered with lexicographical
ordering. Namely, given $w = (w_0, \ldots w_i)$ and
$w' = (w'_0, \ldots, w'_i)$ in $W$ we say
$$
w > w' \Leftrightarrow
\exists j,\ 0 \leq j \leq i :
w_i = w'_i,\ w_{i - 1} = w'_{i - 1},\ \ldots ,
\ w_{j + 1} = w'_{j + 1},\ w_j > w'_j
$$
and so on. Suppose given a section
$s = s_1 \cdot \ldots \cdot s_r$ of
$\mathcal{S} \times \ldots \times \mathcal{S}$
over $U$. We say that the {\it weight of $s$ is defined}
if we have $s_a \in \mathcal{S}_{j_a}(U)$ for a unique
$0 \leq j_a \leq i$. In this case we define the weight
$$
w(s) = (w_0(s), \ldots, w_i(s)) \in W,\quad
w_j(s) = |\{a \mid j_a = j\}|
$$
The weight of any section of $\mathcal{S} \times \ldots \times \mathcal{S}$
is defined locally. The reader checks easily that we obtain a disjoint union
decompostion
$$
\mathcal{S} \times \ldots \times \mathcal{S} =
\coprod\nolimits_{w \in W} \left(
\mathcal{S} \times \ldots \times \mathcal{S}\right)_w
$$
into the subsheaves of sections of a given weight. Of course
only $w \in W$ with $\sum_{0 \leq j \leq i} w_j = r$ show up for a given $r$.
We correspondingly obtain a decomposition
$$
\mathcal{A}_i = \mathcal{O} \oplus
\bigoplus\nolimits_{r \geq 1}
\bigoplus\nolimits_{w \in W}
\mathcal{O}[\left(\mathcal{S} \times \ldots \times \mathcal{S}\right)_w]
$$
The rest of the proof relies on the following trivial observation:
given $r$, $w$ and local section $s = s_1 \cdot \ldots \cdot s_r$ of
$\left(\mathcal{S} \times \ldots \times \mathcal{S}\right)_w$
we have
$$
\text{d}(s) \text{ is a local section of } \mathcal{O} \oplus
\bigoplus\nolimits_{r' \geq 1}
\bigoplus\nolimits_{w' \in W,\ w' < w}
\mathcal{O}[\left(\mathcal{S} \times \ldots \times \mathcal{S}\right)_{w'}]
$$
The reason is that in each of the expressions
$$
(-1)^{\deg(s_1) + \ldots + \deg(s_{a - 1})}
s_1 \cdot \ldots s_{a - 1} \cdot \delta(s_a) \cdot
s_{a + 1} \cdot \ldots \cdot s_r
$$
whose sum give the element $\text{d}(s)$ the element $\delta(s_a)$
is locally a $\mathcal{O}$-linear combination of elements
$s'_1 \cdot \ldots \cdot s'_{r'}$ with $s'_{a'}$ in
$\mathcal{S}_{j'_a}$ for some $0 \leq j'_{a'} < j_a$ where $j_a$ is such that
$s_a$ is section of $\mathcal{S}_{j_a}$.

\medskip\noindent
What this means is the following. Suppose for $w \in W$ we set
$$
F_w \mathcal{A}_i = \mathcal{O} \oplus \bigoplus\nolimits_{r \geq 1}
\bigoplus\nolimits_{w' \in W,\ w' \leq w}
\mathcal{O}[\left(\mathcal{S} \times \ldots \times \mathcal{S}\right)_{w'}]
$$
By the observation above this is a differential graded $\mathcal{O}$-submodule.
We get admissible short exact sequences
$$
0 \to \colim_{w' < w} F_{w'}\mathcal{A}_i \to
F_w\mathcal{A}_i \to
\bigoplus\nolimits_{r \geq 1}
\mathcal{O}[\left(\mathcal{S} \times \ldots \times \mathcal{S}\right)_w]
\to 0
$$
of differential graded $\mathcal{A}$-modules where the differential
on the right hand side is zero.

\medskip\noindent
Now we finish the proof by transfinite induction over the ordered
set $W$. The differential graded complex $F_0\mathcal{A}_0$ is
the summand $\mathcal{O}$ and this is K-flat and graded flat.
For $w \in W$ if the result is true for $F_{w'}\mathcal{A}_i$
for $w' < w$, then by Lemmas \ref{lemma-good-direct-sum},
\ref{lemma-good-admissible-ses}, and \ref{lemma-free-graded-module-good}
we obtain the result for $w$. Finally, we have
$\mathcal{A}_i = \colim_{w \in W} F_w\mathcal{A}_i$ and
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-good-dga}
Let $(\mathcal{C}, \mathcal{O})$ be a ringed site.
Let $(\mathcal{B}, \text{d})$ be a differential graded $\mathcal{O}$-algebra.
There exists a quasi-isomorphism of differential graded $\mathcal{O}$-algebras
$(\mathcal{A}, \text{d}) \to (\mathcal{B}, \text{d})$ such that
$\mathcal{A}$ is graded flat and K-flat as a complex of $\mathcal{O}$-modules
and such that the same is true after pullback by any morphism of
ringed topoi.
\end{lemma}

\begin{proof}
The proof is exactly the same as the first proof of
Lemma \ref{lemma-resolve} but now working with free graded
algebras instead of free graded modules.

\medskip\noindent
We will construct $\mathcal{A} = \colim \mathcal{A}_i$ as in
Lemma \ref{lemma-special-good} by constructing
$$
\mathcal{A}_0 \to \mathcal{A}_1 \to \mathcal{A}_2 \to \ldots \to \mathcal{B}
$$
Let $\mathcal{S}_0$ be the sheaf of graded sets
(Remark \ref{remark-sheaf-graded-sets})
whose degree $n$ part is $\Ker(\text{d}_\mathcal{B}^n)$.
Consider the homomorphism of differential
graded modules
$$
\mathcal{A}_0 = \mathcal{O}\langle \mathcal{S}_0 \rangle
\longrightarrow
\mathcal{B}
$$
where map sends a local section $s$ of $\mathcal{S}_0$
to the corresponding local section of $\mathcal{A}^{\deg(s)}$
(which is in the kernel of the differential, so our map is
a map of differential graded algebras indeed). By construction the
induced maps on cohomology sheaves $H^n(\mathcal{A}_0) \to H^n(\mathcal{B})$
are surjective and hence the same will remain true for all $i$.

\medskip\noindent
Induction step of the construction. Given $\mathcal{A}_i \to \mathcal{B}$
denote $\mathcal{S}_{i + 1}$ the sheaf of graded sets whose degree $n$ part is
$$
\Ker(\text{d}_{\mathcal{A}_i}^{n + 1})
\times_{\mathcal{B}^{n + 1}, \text{d}}
\mathcal{B}^n
$$
This comes equipped with a canonical map
$$
\delta_{i + 1} : \mathcal{S}_{i + 1} \longrightarrow
\mathcal{A}_i
$$
whose image is contained in the kernel of $\text{d}_{\mathcal{A}_i}$
by construction. Hence $\mathcal{A}_{i + 1} = \mathcal{O}\langle
\mathcal{S}_0 \amalg \ldots \mathcal{S}_{i + 1}\rangle$ has a differential
exteding the differential on $\mathcal{A}_i$, see discussion at the
start of this section. The map from $\mathcal{A}_{i + 1}$ to
$\mathcal{B}$ is the unique map of graded algebras which
restricts to the given map on $\mathcal{A}_i$ and sends
a local section $s = (a, b)$ of $\mathcal{S}_{i + 1}$
to $b$ in $\mathcal{B}$. This is compatible with differentials
exactly because $\text{d}(b)$ is the image of $a$ in $\mathcal{B}$.

\medskip\noindent
The map $\mathcal{A} \to \mathcal{B}$ is a quasi-isomorphism:
we have $H^n(\mathcal{A}) = \colim H^n(\mathcal{A}_i)$
and for each $i$ the map $H^n(\mathcal{A}_i) \to H^n(\mathcal{B})$
is surjective with kernel annihilated by the map
$H^n(\mathcal{A}_i) \to H^n(\mathcal{A}_{i + 1})$ by construction.
Finally, the flatness condition for $\mathcal{A}$ where shown in
Lemma \ref{lemma-special-good}.
\end{proof}






\section{Miscellany}
\label{section-misc}

\noindent
Let $(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O})
\to (\Sh(\mathcal{C}'), \mathcal{O}')$ be a morphism of
ringed topoi. Let $\mathcal{A}$ be a sheaf of differential graded
$\mathcal{O}$-algebras. Using the composition\footnote{It would be
more precise to write
$F(\mathcal{A}) \otimes_\mathcal{O}^\mathbf{L} F(\mathcal{A})
\to F(\mathcal{A} \otimes_\mathcal{O} \mathcal{A}) \to F(\mathcal{A})$
were $F$ denotes the forgetful functor to complexes of $\mathcal{O}$-modules.
Also, note that $\mathcal{A} \otimes_\mathcal{O} \mathcal{A}$ indicates
the tensor product of Section \ref{section-tensor-product-dg} so that
$F(\mathcal{A} \otimes_\mathcal{O} \mathcal{A}) =
\text{Tot}(F(\mathcal{A}) \otimes_\mathcal{O} F(\mathcal{A}))$.
The first arrow of the sequence is the canonical map from the derived tensor
product of two complexes of $\mathcal{O}$-modules to the usual tensor
product of complexes of $\mathcal{O}$-modules.}
$$
\mathcal{A} \otimes_\mathcal{O}^\mathbf{L} \mathcal{A}
\longrightarrow
\mathcal{A} \otimes_\mathcal{O} \mathcal{A}
\longrightarrow
\mathcal{A}
$$
and the relative cup product (see Cohomology on Sites, Remark
\ref{sites-cohomology-remark-cup-product} and
Section \ref{sites-cohomology-section-cup-product})
we obtain a multiplication\footnote{Here and below
$Rf_* : D(\mathcal{O}) \to D(\mathcal{O}')$ is the derived
functor studied in
Cohomology on Sites, Section \ref{sites-cohomology-section-unbounded} ff.}
$$
\mu :
Rf_*\mathcal{A} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\longrightarrow
Rf_*\mathcal{A}
$$
in $D(\mathcal{O}')$. This multiplication is associative in the sense
that the diagram
$$
\xymatrix{
Rf_*\mathcal{A} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]_-{\mu \otimes 1} \ar[d]_{1 \otimes \mu} & &
Rf_*\mathcal{A} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[d]^\mu \\
Rf_*\mathcal{A} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]^-\mu & &
Rf_*\mathcal{A}
}
$$
commutes in $D(\mathcal{O}')$; this follows from
Cohomology on Sites, Lemma \ref{sites-cohomology-lemma-cup-product-associative}.
In exactly the same way, given a
right differential graded $\mathcal{A}$-module $\mathcal{M}$
we obtain a multiplication
$$
\mu_\mathcal{M} :
Rf_*\mathcal{M} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\longrightarrow
Rf_*\mathcal{M}
$$
in $D(\mathcal{O}')$. This multiplication is compatible with $\mu$
above in the sense that the diagram
$$
\xymatrix{
Rf_*\mathcal{M} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]_-{\mu_\mathcal{M} \otimes 1} \ar[d]_{1 \otimes \mu} & &
Rf_*\mathcal{M} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[d]^{\mu_\mathcal{M}} \\
Rf_*\mathcal{M} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]^-{\mu_\mathcal{M}} & &
Rf_*\mathcal{M}
}
$$
commutes in $D(\mathcal{O}')$; again this follows from
Cohomology on Sites, Lemma \ref{sites-cohomology-lemma-cup-product-associative}.

\medskip\noindent
A particular example of the above is when one takes $f$ to be the morphism
to the punctual topos $\Sh(pt)$. In that case $\mu$ is just the cup product
map
$$
R\Gamma(\mathcal{C}, \mathcal{A})
\otimes_{\Gamma(\mathcal{C}, \mathcal{O})}^\mathbf{L}
R\Gamma(\mathcal{C}, \mathcal{A})
\longrightarrow
R\Gamma(\mathcal{C}, \mathcal{A}),
\quad \eta \otimes \theta \mapsto \eta \cup \theta
$$
and similarly $\mu_\mathcal{M}$ is the cup product map
$$
R\Gamma(\mathcal{C}, \mathcal{M})
\otimes_{\Gamma(\mathcal{C}, \mathcal{O})}^\mathbf{L}
R\Gamma(\mathcal{C}, \mathcal{A})
\longrightarrow
R\Gamma(\mathcal{C}, \mathcal{M}),
\quad \eta \otimes \theta \mapsto \eta \cup \theta
$$
In general, via the identifications
$$
R\Gamma(\mathcal{C}, \mathcal{A}) =
R\Gamma(\mathcal{C}', Rf_*\mathcal{A})
\quad\text{and}\quad
R\Gamma(\mathcal{C}, \mathcal{M}) =
R\Gamma(\mathcal{C}', Rf_*\mathcal{M})
$$
of Cohomology on Sites, Remark \ref{sites-cohomology-remark-before-Leray}
the map $\mu_\mathcal{M}$ induces the cup product on cohomology.
To see this use
Cohomology on Sites, Lemma \ref{sites-cohomology-lemma-compose-cup-product}
where the second morphism of topoi is the morphism from $\Sh(\mathcal{C}')$
to the punctual topos as above.

\medskip\noindent
If $\mathcal{M}_1 \to \mathcal{M}_2$ is a homomorphism of
right differential graded $\mathcal{A}$-modules, then the diagram
$$
\xymatrix{
Rf_*\mathcal{M}_1 \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]_-{\mu_{\mathcal{M}_1}} \ar[d] & &
Rf_*\mathcal{M}_1 \ar[d] \\
Rf_*\mathcal{M}_2 \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]^-{\mu_{\mathcal{M}_2}} & &
Rf_*\mathcal{M}_2
}
$$
commutes in $D(\mathcal{O}')$; this follows from the fact that the relative
cup product is functorial. Suppose we have a short exact sequence
$$
0 \to \mathcal{M}_1 \xrightarrow{a} \mathcal{M}_2 \to \mathcal{M}_3 \to 0
$$
of right differential graded $\mathcal{A}$-modules. Then we claim
that the diagram
$$
\xymatrix{
Rf_*\mathcal{M}_3 \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]_-{\mu_{\mathcal{M}_3}} \ar[d]_{Rf_*\delta \otimes \text{id}} & & 
Rf_*\mathcal{M}_3 \ar[d]^{Rf_*\delta} \\
Rf_*\mathcal{M}_1[1] \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]^-{\mu_{\mathcal{M}_1[1]}} & &
Rf_*\mathcal{M}_1[1]
}
$$
commutes in $D(\mathcal{O}')$ where
$\delta : \mathcal{M}_3 \to \mathcal{M}_1[1]$ is the
morphism of $D(\mathcal{O})$ coming from the given
short exact sequence (see
Derived Categories, Section \ref{derived-section-canonical-delta-functor}).
This is clear if our sequence is split as a sequence of graded right
$\mathcal{A}$-modules, because in this case $\delta$ can be represented
by a map of right $\mathcal{A}$-modules and the discussion above applies.
In general we argue using the cone on $a$ and the diagram
$$
\xymatrix{
\mathcal{M}_1 \ar[r]_a \ar[d] &
\mathcal{M}_2 \ar[r]_i \ar[d] &
C(a) \ar[r]_{-p} \ar[d]^q &
\mathcal{M}_1[1] \ar[d] \\
\mathcal{M}_1 \ar[r] &
\mathcal{M}_2 \ar[r] &
\mathcal{M}_3 \ar[r]^\delta &
\mathcal{M}_1[1]
}
$$
where the right square is commutative in $D(\mathcal{O})$ by the definition of
$\delta$ in Derived Categories, Lemma
\ref{derived-lemma-derived-canonical-delta-functor}.
Now the cone $C(a)$ has the structure of a right differential graded
$\mathcal{A}$-module such that $i$, $p$, $q$ are homomorphisms of
right differential graded $\mathcal{A}$-modules, see
Definition \ref{definition-cone}.
Hence by the above we know that the corresponding
diagrams commute for the morphisms $q$ and $-p$.
Since $q$ is an isomorphism in $D(\mathcal{O})$ we conclude the
same is true for $\delta$ as desired.

\medskip\noindent
In the situation above given a right differential graded $\mathcal{A}$-module
$\mathcal{M}$ let
$$
\xi \in H^n(\mathcal{C}, \mathcal{M})
$$
In other words, $\xi$ is a degree $n$ cohomology class in the cohomology
of $\mathcal{M}$ viewed as a complex of $\mathcal{O}$-modules. By
Lemma \ref{lemma-cohomology-ext} we can construct maps
$$
x : \mathcal{A} \rightarrow \mathcal{M}'[n]
\quad\text{and}\quad
s : \mathcal{M} \to \mathcal{M}'
$$
of right differential graded $\mathcal{A}$-modules where $s$ is a
quasi-isomorphism and such that $\xi$ is the image of
$1 \in H^0(\mathcal{C}, \mathcal{A})$ via the morphism
$s[n]^{-1} \circ x$ in the derived category
$D(\mathcal{A}, \text{d})$ and a fortiori in the derived
category $D(\mathcal{O})$. It follows that the corresponding map
$$
\xi' = (s[n])^{-1} \circ x : \mathcal{A} \longrightarrow \mathcal{M}[n]
$$
in $D(\mathcal{O})$ is uniquely characterized by the following
two properties
\begin{enumerate}
\item $\xi'$ can be lifted to a morphism in $D(\mathcal{A}, \text{d})$, and
\item $\xi = \xi'(1)$ in
$H^0(\mathcal{C}, \mathcal{M}[n]) = H^n(\mathcal{C}, \mathcal{M})$.
\end{enumerate}
Using the compatibilities of $x$ and $s$ with the relative cup product
discussed above it follows that for every\footnote{For example
the identity morphism.} morphism of ringed topoi
$(f, f^\sharp) : (\Sh(\mathcal{C}), \mathcal{O})
\to (\Sh(\mathcal{C}'), \mathcal{O}')$ the derived pushforward
$$
Rf_*\xi' : Rf_*\mathcal{A}  \longrightarrow Rf_*\mathcal{M}[n]
$$
of $\xi'$ is compatible with the maps $\mu$ and $\mu_{\mathcal{M}[n]}$
constructed above in the sense that the diagram
$$
\xymatrix{
Rf_*\mathcal{A} \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]_-\mu \ar[d]_{Rf_*\xi' \otimes \text{id}}  & &
Rf_*\mathcal{A} \ar[d]^{Rf_*\xi'} \\
Rf_*\mathcal{M}[n] \otimes_{\mathcal{O}'}^\mathbf{L} Rf_*\mathcal{A}
\ar[rr]^-{\mu_{\mathcal{M}[n]}} & &
Rf_*\mathcal{M}[n]
}
$$
commutes in $D(\mathcal{O}')$. Using this compatibility for the
map to the punctual topos, we see in particular that
$$
\xymatrix{
R\Gamma(\mathcal{C}, \mathcal{A})
\otimes_{\Gamma(\mathcal{C}, \mathcal{O})}^\mathbf{L}
R\Gamma(\mathcal{C}, \mathcal{A})
\ar[d]_{\xi' \otimes \text{id}} \ar[r] &
R\Gamma(\mathcal{C}, \mathcal{A}) \ar[d]^{\xi'} \\
R\Gamma(\mathcal{C}, \mathcal{M}[n])
\otimes_{\Gamma(\mathcal{C}, \mathcal{O})}^\mathbf{L}
R\Gamma(\mathcal{C}, \mathcal{A})
\ar[r] &
R\Gamma(\mathcal{C}, \mathcal{M}[n])
}
$$
commutes. Combined with $\xi'(1) = \xi$ this implies that
the induced map on cohomology
$$
\xi' : R\Gamma(\mathcal{C}, \mathcal{A}) \to
R\Gamma(\mathcal{C}, \mathcal{M}[n]), \quad \eta \mapsto \xi \cup \eta
$$
is given by left cup product by $\xi$ as indicated.














\section{Differential graded modules on a category}
\label{section-modules-cohomology}

\noindent
This section is the continuation of
Cohomology on Sites, Section \ref{sites-cohomology-section-modules-cohomology}.

\medskip\noindent
Let $\mathcal{C}$ be a category. We think of $\mathcal{C}$ as a site with
the chaotic topology. Let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$.
Let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded
$\mathcal{O}$-algebras. In other words, $\mathcal{O}$ is
a presheaf of rings on the category $\mathcal{C}$ and
$(\mathcal{A}, \text{d})$ is a presheaf of differential graded
$\mathcal{O}$-algebras on $\mathcal{C}$, see
Categories, Definition \ref{categories-definition-presheaf}.

\begin{definition}
\label{definition-cartesian}
In the situation above, we denote
{\it $\mathit{QC}(\mathcal{A}, \text{d})$}
the full subcategory of $D(\mathcal{A}, \text{d})$
consisting of objects $M$ such that
for all $U \to V$ in $\mathcal{C}$ the canonical map
$$
R\Gamma(V, M) \otimes_{\mathcal{A}(V)}^\mathbf{L} \mathcal{A}(U)
\longrightarrow
R\Gamma(U, M)
$$
is an isomorphism in $D(\mathcal{A}(U), \text{d})$.
\end{definition}

\begin{lemma}
\label{lemma-cartesian-good-sub}
In the situation above, the subcategory $\mathit{QC}(\mathcal{A}, \text{d})$
is a strictly full, saturated, triangulated subcategory of
$D(\mathcal{A}, \text{d})$ preserved by arbitrary direct sums.
\end{lemma}

\begin{proof}
Let $U$ be an object of $\mathcal{C}$. Since the topology
on $\mathcal{C}$ is chaotic, the functor $\mathcal{F} \mapsto \mathcal{F}(U)$
is exact and commutes with direct sums. Hence the exact functor
$M \mapsto R\Gamma(U, M)$ is computed by representing $K$ by any
differential graded $\mathcal{A}$-module
$\mathcal{M}$ and taking $\mathcal{M}(U)$.
Thus $R\Gamma(U, -)$ commutes with direct sums, see
Lemma \ref{lemma-derived-products}.
Similarly, given a morphism $U \to V$ of $\mathcal{C}$
the derived tensor product functor
$- \otimes_{\mathcal{O}(A)}^\mathbf{L} \mathcal{A}(U) :
D(\mathcal{A}(V)) \to D(\mathcal{A}(U))$
is exact and commutes with direct sums. The lemma follows
from these observations in a straightforward manner; details omitted.
\end{proof}

\begin{remark}
\label{remark-cartesian-brown}
As above, let $\mathcal{C}$ be a category viewed as a site with
the chaotic topology, let $\mathcal{O}$ be a sheaf of rings on $\mathcal{C}$,
and let $(\mathcal{A}, \text{d})$ be a sheaf of differential graded
$\mathcal{O}$-algebras. Then the analogue of
Cohomology on Sites, Proposition
\ref{sites-cohomology-proposition-cartesian-brown}
holds for $\mathit{QC}(\mathcal{A}, \text{d})$ with almost
exactly the same proof:
\begin{enumerate}
\item any contravariant cohomological functor
$H : \mathit{QC}(\mathcal{A}, \text{d}) \to \textit{Ab}$
which transforms direct sums into products is representable,
\item any exact functor
$F : \mathit{QC}(\mathcal{A}, \text{d}) \to \mathcal{D}$
of triangulated categories which transforms direct sums into direct sums
has an exact right adjoint, and
\item the inclusion functor
$\mathit{QC}(\mathcal{A}, \text{d}) \to D(\mathcal{A}, \text{d})$ has
an exact right adjoint.
\end{enumerate}
If we ever need this we will precisely formulate and prove this here.
\end{remark}

\noindent
Let $u : \mathcal{C}' \to \mathcal{C}$ be a functor between categories.
If we view $\mathcal{C}$ and $\mathcal{C}'$ as sites with the chaotic
topology, then $u$ is a continuous and cocontinuous functor. Hence
we obtain a morphism $g : \Sh(\mathcal{C}') \to \Sh(\mathcal{C})$
of topoi, see Sites, Lemma \ref{sites-lemma-cocontinuous-morphism-topoi}.
Additionally, suppose given sheaves of rings $\mathcal{O}$ on $\mathcal{C}$
and $\mathcal{O}'$ on $\mathcal{C}'$ and a map
$g^\sharp : g^{-1}\mathcal{O} \to \mathcal{O}'$.
We denote the corresponding morphism of ringed topoi simply
$g : (\Sh(\mathcal{C}'), \mathcal{O}') \to (\Sh(\mathcal{C}), \mathcal{O})$,
see Modules on Sites, Section \ref{sites-modules-section-ringed-topoi}.
Finally, suppose that $(\mathcal{A}, \text{d})$ is a sheaf of differential
graded $\mathcal{O}$-algebras and that 
$(\mathcal{A}', \text{d})$ is a sheaf of differential
graded $\mathcal{O}'$-algebras and moreover that we are given a map
$\varphi : g^*\mathcal{A} \to \mathcal{A}'$ of differential graded
$\mathcal{O}'$-algebras (see Section \ref{section-functoriality-dg}).

\begin{lemma}
\label{lemma-cartesian-functorial}
Let $g : (\Sh(\mathcal{C}'), \mathcal{O}') \to (\Sh(\mathcal{C}), \mathcal{O})$
and $\varphi : g^*\mathcal{A} \to \mathcal{A}'$
be as above. Then the functor
$Lg^* : D(\mathcal{A}, \text{d}) \to D(\mathcal{A}', \text{d})$
maps $\mathit{QC}(\mathcal{A}, \text{d})$ into
$\mathit{QC}(\mathcal{A}', \text{d})$.
\end{lemma}

\begin{proof}
Let $U' \in \Ob(\mathcal{C}')$ with image $U = u(U')$ in $\mathcal{C}$.
Let $pt$ denote the category with a single object and a single morphism.
Denote $(\Sh(pt), \mathcal{O}'(U'))$ and $(\Sh(pt), \mathcal{O}(U))$
the ringed topoi as indicated endowed with the differential graded
algebras $\mathcal{A}'(U)$ and $\mathcal{A}(U)$.
Of course we identify the derived category of differential graded modules
on these with $D(\mathcal{A}'(U'), \text{d})$ and
$D(\mathcal{A}(U), \text{d})$.
Then we have a commutative diagram of ringed topoi
$$
\xymatrix{
(\Sh(pt), \mathcal{O}'(U')) \ar[rr]_{U'} \ar[d] & &
(\Sh(\mathcal{C}'), \mathcal{O}') \ar[d]^g \\
(\Sh(pt), \mathcal{O}(U)) \ar[rr]^U & &
(\Sh(\mathcal{C}), \mathcal{O})
}
$$
each endowed with corresponding differential graded algebras.
Pullback along the lower horizontal morphism sends $M$ in
$D(\mathcal{A}, \text{d})$ to $R\Gamma(U, K)$ viewed as an
object in $D(\mathcal{A}(U), \text{d})$.
Pullback by the left vertical arrow sends $M$ to
$M \otimes_{\mathcal{A}(U)}^\mathbf{L} \mathcal{A}'(U')$.
Going around the diagram either direction produces the same result
(Lemma \ref{lemma-compose-pullback}) and hence we conclude
$$
R\Gamma(U', Lg^*K) =
R\Gamma(U, K) \otimes_{\mathcal{A}(U)}^\mathbf{L} \mathcal{A}'(U')
$$
Finally, let $f' : U' \to V'$ be a morphism in $\mathcal{C}'$ and
denote $f = u(f') : U = u(U') \to V = u(V')$ the image in $\mathcal{C}$.
If $K$ is in $\mathit{QC}(\mathcal{A}, \text{d})$ then we have
\begin{align*}
R\Gamma(V', Lg^*K) \otimes_{\mathcal{A}'(V')}^\mathbf{L} \mathcal{A}'(U')
& =
R\Gamma(V, K) \otimes_{\mathcal{A}(V)}^\mathbf{L} \mathcal{A}'(V')
\otimes_{\mathcal{A}'(V')}^\mathbf{L} \mathcal{A}'(U') \\
& =
R\Gamma(V, K) \otimes_{\mathcal{A}(V)}^\mathbf{L} \mathcal{A}'(U') \\
& =
R\Gamma(V, K) \otimes_{\mathcal{A}(V)}^\mathbf{L} \mathcal{A}(U)
\otimes_{\mathcal{A}(U)}^\mathbf{L} \mathcal{A}'(U') \\
& =
R\Gamma(U, K) \otimes_{\mathcal{A}(U)}^\mathbf{L} \mathcal{A}'(U') \\
& =
R\Gamma(U', Lg^*K)
\end{align*}
as desired. Here we have used the observation above both for $U'$ and $V'$.
\end{proof}






\section{Differential graded modules on a category, bis}
\label{section-modules-cohomology-bis}

\noindent
We develop a few more results on the notion of quasi-coherent
modules introduced in Section \ref{section-modules-cohomology}.

\begin{lemma}
\label{lemma-cartesian-cofinal-subcategory}
Let $\mathcal{C}, \mathcal{O}, \mathcal{A}$ be as in
Section \ref{section-modules-cohomology}. Let
$\mathcal{C}' \subset \mathcal{C}$ be a full subcategory
with the following property: for every $U \in \Ob(\mathcal{C})$ the
category $U/\mathcal{C}'$ of arrows $U \to U'$ is cofiltered.
Denote $\mathcal{O}', \mathcal{A}'$ the restrictions
of $\mathcal{O}, \mathcal{A}$ to $\mathcal{C}'$.
Then restrictions induces an equivalence
$\mathit{QC}(\mathcal{A}, \text{d}) \to \mathit{QC}(\mathcal{A}', \text{d})$.
\end{lemma}

\begin{proof}
We will construct a quasi-inverse of the functor. Namely,
let $M'$ be an object of $\mathit{QC}(\mathcal{A}', \text{d})$.
We may represent $M'$ by a good differential graded module $\mathcal{M}'$,
see Lemma \ref{lemma-resolve}. Then for every $U' \in \Ob(\mathcal{C}')$
the differential graded $\mathcal{A}'(U')$-module $\mathcal{M}'(U)$
is K-flat and graded flat and for every morphism $U'_1 \to U'_2$ of
$\mathcal{C}'$ the map
$$
\mathcal{M}'(U'_2) \otimes_{\mathcal{A}'(U'_2)} \mathcal{A}'(U'_1)
\longrightarrow
\mathcal{M}'(U'_1)
$$
is a quasi-isomorphism (as the source represents the derived tensor product).
Consider the differential graded
$\mathcal{A}$-module $\mathcal{M}$ defined by the rule
$$
\mathcal{M}(U) =
\colim_{U \to U' \in U/\mathcal{C}'}
\mathcal{M}'(U') \otimes_{\mathcal{A}'(U')} \mathcal{A}(U)
$$
This is a filtered colimit of complexes by our assumption in the lemma.
Since $M'$ is in $\mathit{QC}(\mathcal{A}', \text{d})$ all the
transition maps in the system are quasi-isomorphisms. Since filtered
colimits are exact, we see that
$\mathcal{M}(U)$ in $D(\mathcal{A}(U), \text{d})$
is isomorphic to $\mathcal{M}'(U') \otimes_{\mathcal{A}'(U')} \mathcal{A}(U)$
for any morphism $U \to U'$ with $U' \in \Ob(\mathcal{C}')$.

\medskip\noindent
We claim that $\mathcal{M}$ is in
$\mathit{QC}(\mathcal{A}, \text{d})$: namely, given $U \to V$ in
$\mathcal{C}$ we choose a map $V \to V'$ with $V' \in \Ob(\mathcal{C}')$.
By the above we see that the map $\mathcal{M}(V) \to \mathcal{M}(U)$
is identified with the map
$$
\mathcal{M}'(V') \otimes_{\mathcal{A}'(V')} \mathcal{A}(V)
\longrightarrow
\mathcal{M}'(V') \otimes_{\mathcal{A}'(V')} \mathcal{A}(U)
$$
Since $\mathcal{M'}(V')$ is K-flat as
differential gradede $\mathcal{A}'(V')$-module, we conclude
the claim is true.

\medskip\noindent
The natural map $\mathcal{M}|_{\mathcal{C}'} \to \mathcal{M}'$ is an
isomorphism in $D(\mathcal{A}', d)$ as follows immediately from the above.

\medskip\noindent
Conversely, if we have an object $E$ of $\mathit{QC}(\mathcal{A}, \text{d})$,
then we represent it by a good differential graded module $\mathcal{E}$.
Setting $\mathcal{M}' = \mathcal{E}|_{\mathcal{C}'}$ (this is another good
differential graded module) we see that there is a map
$$
\mathcal{E} \to \mathcal{M}
$$
wich over $U$ in $\mathcal{C}$ is given by the map
$$
\mathcal{E}(U)
\longrightarrow
\colim_{U \to U' \in U/\mathcal{C}'}
\mathcal{E}(U') \otimes_{\mathcal{A}'(U')} \mathcal{A}(U)
$$
which is a quasi-isomorphism by the same reason. Thus restriction and
the construction above are quasi-inverse functors as desired.
\end{proof}

\begin{lemma}
\label{lemma-cartesian-qis-equivalence}
Let $\mathcal{C}, \mathcal{O}$ be as in
Section \ref{section-modules-cohomology}. Let
$\varphi : \mathcal{A} \to \mathcal{B}$ be a homomorphism of
differential graded $\mathcal{O}$-algebras which induces an
isomorphism on cohomology sheaves, then the equivalence
$D(\mathcal{A}, \text{d}) \to D(\mathcal{B}, \text{d})$
of Lemma \ref{lemma-qis-equivalence} induces an equivalence
$\mathit{QC}(\mathcal{A}, \text{d}) \to
\mathit{QC}(\mathcal{B}, \text{d})$.
\end{lemma}

\begin{proof}
It suffices to show the following: given a morphism $U \to V$ of $\mathcal{C}$
and $M$ in $D(\mathcal{A}, \text{d})$ the following are equivalent
\begin{enumerate}
\item $R\Gamma(V, M) \otimes_{\mathcal{A}(V)}^\mathbf{L} \mathcal{A}(U)
\to \Gamma(U, M)$ is an isomorphism in $D(\mathcal{A}(U), \text{d})$, and
\item $R\Gamma(V, M \otimes_\mathcal{A}^\mathbf{L} \mathcal{B})
\otimes_{\mathcal{B}(V)}^\mathbf{L} \mathcal{B}(U)
\to \Gamma(U, M \otimes_\mathcal{A}^\mathbf{L} \mathcal{B})$
is an isomorphism in $D(\mathcal{B}(U), \text{d})$.
\end{enumerate}
Since the topology on $\mathcal{C}$ is chaotic, this simply boils down
to fact that $\mathcal{A}(U) \to \mathcal{B}(U)$ and
$\mathcal{A}(V) \to \mathcal{B}(V)$ are quasi-isomorphisms.
Details omitted.
\end{proof}






\section{Inverse systems of differential graded algebras}
\label{section-qc-inverse-system}

\noindent
In this section we consider the following special case of the situation
discussed in Section \ref{section-modules-cohomology}:
\begin{enumerate}
\item $\mathcal{C}$ is the category $\mathbf{N}$
with a unique morphism $i \to j$ if and only if $i \leq j$,
\item $\mathcal{O}$ is the constant (pre)sheaf of rings with value
a given ring $R$.
\end{enumerate}
In this setting a sheaf $\mathcal{A}$ of differential graded
$\mathcal{O}$-algebras is the same thing as an inverse system
$(A_n)$ of differential graded $R$-algebras.
A sheaf $\mathcal{M}$ of differential graded $\mathcal{A}$-modules
is the same thing as an inverse system $(M_n)$ where $M_n$ is
a differential graded $A_n$-module and the transition maps
$M_{n + 1} \to M_n$ are $A_{n + 1}$-module maps.

\medskip\noindent
Suppose that $\mathcal{B} = (B_n)$ is a second inverse system of differential
graded $R$-algebras. Given a morphism $\varphi : (A_n) \to (B_n)$ of
pro-objects we will construct an exact functor from
$\mathit{QC}(\mathcal{A}, \text{d})$ to $\mathit{QC}(\mathcal{B}, \text{d})$.
Namely, according to Categories, Example
\ref{categories-example-pro-morphism-inverse-systems}
the morphism $\varphi$ is given by a sequence
$\ldots \geq m(3) \geq m(2) \geq m(1)$ of integers
and a commutative diagram
$$
\xymatrix{
\ldots \ar[r] &
A_{m(3)} \ar[d]^{\varphi_3} \ar[r] &
A_{m(2)} \ar[d]^{\varphi_2} \ar[r] &
A_{m(1)} \ar[d]^{\varphi_1} \\
\ldots \ar[r] &
B_3 \ar[r] &
B_2 \ar[r] &
B_1
}
$$
of differential graded $R$-algebras. Then given a good sheaf of
differential graded $\mathcal{A}$-modules $\mathcal{M} = (M_n)$
representing an object of $\mathit{QC}(\mathcal{A}, \text{d})$
we can set
$$
N_n = M_{m(n)} \otimes_{A_{m(n)}} B_n
$$
This inverse system determines an object of
$\mathit{QC}(\mathcal{B}, \text{d})$ because the
$A_{m(n)}$-modules $M_{m(n)}$ are K-flat; details omitted.
We also leave it to the reader to show that the resulting
functor is independent of the choices made in its construction.

\begin{lemma}
\label{lemma-pro-isomorphic}
In the situation above, suppose that $\mathcal{A} = (A_n)$ and
$\mathcal{B} = (B_n)$ are inverse systems of differential
graded $R$-algebras. If $\varphi : (A_n) \to (B_n)$ is an isomorphism
of pro-objects, then the functor $\mathit{QC}(\mathcal{A}, \text{d}) \to
\mathit{QC}(\mathcal{B}, \text{d})$ constructed above is an
equivalence.
\end{lemma}

\begin{proof}
Let $\psi : (B_n) \to (A_n)$ be a morphism of pro-objects which
is inverse to $\varphi$. According to the discussion in
Categories, Example
\ref{categories-example-pro-morphism-inverse-systems}
we may assume that $\varphi$ is given by a system of maps
as above and $\psi$ is given $n(1) < n(2) < \ldots$ and
a commutative diagram
$$
\xymatrix{
\ldots \ar[r] &
B_{n(3)} \ar[d]^{\psi_3} \ar[r] &
B_{n(2)} \ar[d]^{\psi_2} \ar[r] &
B_{n(1)} \ar[d]^{\psi_1} \\
\ldots \ar[r] &
A_3 \ar[r] &
A_2 \ar[r] &
A_1
}
$$
of differential graded $R$-algebras. Since
$\varphi \circ \psi = \text{id}$ we may, after possibly
increasing the values of the functions $n(\cdot)$ and
$m(\cdot)$ assume that $B_{n(m(i))} \to A_{m(i)} \to B_i$
is the identity. It follows that the composition of the
functors
$$
\mathit{QC}(\mathcal{B}, \text{d}) \to
\mathit{QC}(\mathcal{A}, \text{d}) \to
\mathit{QC}(\mathcal{B}, \text{d})
$$
sends a good sheaf of
differential graded $\mathcal{B}$-modules $\mathcal{N} = (N_n)$
to the inverse system $\mathcal{N}' = (N'_i)$ with values
$$
N'_i = N_{n(m(i))} \otimes_{B_{n(m(i))}} B_i
$$
which is canonically quasi-isomorphic to $\mathcal{N}$
exactly because $\mathcal{N}$ is an object of
$\mathit{QC}(\mathcal{B}, \text{d})$
and because $N_j$ is a K-flat differential graded
module for all $j$. Since the same is true for the
composition the other way around we conclude.
\end{proof}

\noindent
Let $\mathcal{C} = \mathbf{N}$ and $\mathcal{O}$ the constant sheaf
with value a ring $R$ and let $\mathcal{A}$ be given by an inverse
system $(A_n)$ of differential graded $R$-algebras. Suppose given two
left differential graded $\mathcal{A}$-modules $\mathcal{N}$ and
$\mathcal{N}'$ given by inverse systems $(N_n)$ and $(N'_n)$.
Thus each $N_n$ and $N'_n$ is a left differential graded $A_n$-module.
Let us temporarily say that $(N_n)$ and $(N'_n)$ are
{\it pro-isomorphic in the derived category}
if there exist a sequence of integers
$$
1 = n_0 < n_1 < n_2 < n_3 < \ldots
$$
and maps
$$
N_{n_{2i}} \to N'_{n_{2i - 1}}
\quad\text{in}\quad
D(A_{n_{2i}}^{opp}, \text{d})
$$
and
$$
N'_{n_{2i + 1}} \to N'_{n_{2i}}
\quad\text{in}\quad
D(A_{n_{2i + 1}}^{opp}, \text{d})
$$
such that the compositions $N_{n_{2i}} \to N_{n_{2i - 2}}$
and $N'_{n_{2i + 1}} \to N'_{2i - 1}$ are given by the transition
maps of the respective systems.

\begin{lemma}
\label{lemma-pro-isomorphic-systems-tensor}
If $(N_n)$ and $(N'_n)$ are pro-isomorphic in the derived category
as defined above,
then for every object $(M_n)$ of $D(\mathbf{N}, \mathcal{A})$ we have
$$
R\lim (M_n \otimes_{A_n}^\mathbf{L} N_n) =
R\lim (M_n \otimes_{A_n}^\mathbf{L} N'_n)
$$
in $D(R)$.
\end{lemma}

\begin{proof}
The assumption implies that the inverse system
$(M_n \otimes_{A_n}^\mathbf{L} N_n)$ of $D(R)$ is pro-isomorphic
(in the usual sense) to the inverse system
$(M_n \otimes_{A_n}^\mathbf{L} N'_n)$ of $D(R)$. Hence the
result follows from the fact that taking $R\lim$ is well
defined for inverse systems in the derived category, see
discussion in More on Algebra, Section \ref{more-algebra-section-Rlim-modules}.
\end{proof}

\begin{lemma}
\label{lemma-different-tensors}
\begin{reference}
This is a variant of \cite[Lemma 3.5.4]{BS}
\end{reference}
Let $R$ be a ring. Let $f_1, \ldots, f_r \in R$.
Let $K_n$ be the Koszul complex on $f_1^n, \ldots, f_r^n$
viewed as a differential graded $R$-algebra.
Let $(M_n)$ be an object of $D(\mathbf{N}, (K_n))$.
Then for any $t \geq 1$ we have
$$
R\lim (M_n \otimes_R^\mathbf{L} K_t) =
R\lim (M_n \otimes_{K_n}^\mathbf{L} K_t)
$$
in $D(R)$.
\end{lemma}

\begin{proof}
We fix $t \geq 1$. For $n \geq t$ let us denote ${}_nK_t$
the differential graded $R$-algebra $K_t$ viewed as a left differential graded
$K_n$-module. Observe that
$$
M_n \otimes_R^\mathbf{L} K_t =
M_n \otimes_{K_n}^\mathbf{L} (K_n \otimes_R^\mathbf{L} K_t) =
M_n \otimes_{K_n}^\mathbf{L} (K_n \otimes_R K_t)
$$
Hence by Lemma \ref{lemma-pro-isomorphic-systems-tensor}
it suffices to show that
$({}_nK_t)$ and $(K_n \otimes_R K_t)$ are pro-isomorphic in the
derived category. The multiplication maps
$$
K_n \otimes_R K_t \longrightarrow {}_nK_t
$$
are maps of left differential graded $K_n$-modules. Thus to finish the proof
it suffices to show that for all $n \geq 1$ there exists an $N > n$
and a map
$$
{}_NK_t \longrightarrow {}_NK_n \otimes_R K_t
$$
in $D(K_N^{opp}, \text{d})$ whose composition with the multiplication
map is the transition map (in either direction). This is done in
Divided Power Algebra, Lemma \ref{dpa-lemma-construct-some-maps}
by an explicit construction.
\end{proof}

\begin{proposition}
\label{proposition-derived-complete}
Let $R$ be a Noetherian ring. Let $I \subset R$ be an ideal.
The following three categories are canonically equivalent:
\begin{enumerate}
\item Let $\mathcal{A}$ be the sheaf of $R$-algebras on $\mathbf{N}$
corresponding to the inverse system of $R$-algebras $A_n = R/I^n$.
The category $\mathit{QC}(\mathcal{A})$.
\item Choose generators $f_1, \ldots, f_r$ of $I$. Let
$\mathcal{B}$ be the sheaf of differential graded $R$-algebras
on $\mathbf{N}$ corresponding to the inverse system of
Koszul algebras on $f_1^n, \ldots, f_r^n$.
The category $\mathit{QC}(\mathcal{B})$.
\item The full subcategory $D_{comp}(R, I) \subset D(R)$
of derived complete objects, see More on Algebra, Definition
\ref{more-algebra-definition-derived-complete} and text following.
\end{enumerate}
\end{proposition}

\begin{proof}
Consider the obvious morphism
$f : (\Sh(\mathbf{N}), \mathcal{A}) \to (\Sh(pt), R)$
of ringed topoi
and let us consider the adjoint functors $Lf^*$ and $Rf_*$.
The first restricts to a functor
$$
F : D_{comp}(R, I) \longrightarrow \mathit{QC}(\mathcal{A})
$$
which sends an object $K$ of $D_{comp}(R, I)$ represented by a
K-flat complex $K^\bullet$ to the object $(K^\bullet \otimes_R R/I^n)$
of $\mathit{QC}(\mathcal{A})$. The second restricts to a functor
$$
G : \mathit{QC}(\mathcal{A}) \longrightarrow D_{comp}(R, I)
$$
which sends an object $(M_n^\bullet)$ of $\mathit{QC}(\mathcal{A})$
to $R\lim M_n^\bullet$. The output is derived complete for example
by More on Algebra, Lemma \ref{more-algebra-lemma-naive-derived-completion}.
Also, it follows from More on Algebra, Proposition
\ref{more-algebra-proposition-noetherian-naive-completion-is-completion}
that $G \circ F = \text{id}$. Thus to see that $F$ and $G$
are quasi-inverse equivalences it suffices to see that the kernel
of $G$ is zero (see Derived Categories, Lemma
\ref{derived-lemma-fully-faithful-adjoint-kernel-zero}).
However, it does not appear easy to show this directly!

\medskip\noindent
In this paragraph we will show that $\mathit{QC}(\mathcal{A})$ and
$\mathit{QC}(\mathcal{B})$ are equivalent.
Write $\mathcal{B} = (B_n)$ where $B_n$ is the Koszul complex
viewed as a cochain complex in degrees $-r, -r + 1, \ldots, 0$.
By Divided Power Algebra, Remark \ref{dpa-remark-pro-system-koszul}
(but with chain complexes
turned into cochain complexes)
we can find $1 < n_1 < n_2 < \ldots$
and maps of differential graded $R$-algebras
$B_{n_i} \to E_i \to R/(f_1^{n_i}, \ldots, f_r^{n_i})$
and $E_i \to B_{n_{i - 1}}$ such that
$$
\xymatrix{
B_{n_1} \ar[d] &
B_{n_2} \ar[d] \ar[l] &
B_{n_3} \ar[d] \ar[l] &
\ldots \ar[l] \\
E_1 \ar[d] &
E_2 \ar[l] \ar[d] &
E_3 \ar[l] \ar[d] &
\ldots \ar[l] \\
B_1 &
B_{n_1} \ar[l] &
B_{n_2} \ar[l] &
\ldots \ar[l]
}
$$
is a commutative diagram of differential graded $R$-algebras
and such that $E_i \to R/(f_1^{n_i}, \ldots, f_r^{n_i})$ is
a quasi-isomorphism. We conclude
\begin{enumerate}
\item there is an equivalence between $\mathit{QC}(\mathcal{B})$ and
$\mathit{QC}((E_i))$,
\item there is an equivalence between
$\mathit{QC}((E_i))$ and $\mathit{QC}((R/(f_1^{n_i}, \ldots, f_r^{n_i})))$,
\item there is an equivalence between
$\mathit{QC}((R/(f_1^{n_i}, \ldots, f_r^{n_i})))$ and
$\mathit{QC}(\mathcal{A})$.
\end{enumerate}
Namely, for (1) we can apply Lemma \ref{lemma-pro-isomorphic}
to the diagram above which shows that $(E_i)$ and $(B_n)$ are pro-isomorphic.
For (2) we can apply  Lemma \ref{lemma-cartesian-qis-equivalence} to the
inverse system of quasi-isomorphisms $E_i \to R/(f_1^{n_i}, \ldots, f_r^{n_i})$.
For (3) we can apply Lemma \ref{lemma-pro-isomorphic}
and the elementary fact that the inverse systems $(R/I^n)$ and
$(R/(f_1^{n_i}, \ldots, f_r^{n_i})$ are pro-isomorphic.

\medskip\noindent
Exactly as in the first paragraph of the proof we can define
adjoint functors\footnote{It can be shown that these functors are,
via the equivalences above, compatible with $F$ and $G$ defined before.}
$$
F' : D_{comp}(R, I) \longrightarrow \mathit{QC}(\mathcal{B})
\quad\text{and}\quad
G' : \mathit{QC}(\mathcal{B}) \longrightarrow D_{comp}(R, I).
$$
The first sends an object $K$ of $D_{comp}(R, I)$ represented by a
K-flat complex $K^\bullet$ to the object $(K^\bullet \otimes_R B_n)$
of $\mathit{QC}(\mathcal{B})$. The second sends an object
$(M_n)$ of $\mathit{QC}(\mathcal{B})$ to $R\lim M_n$.
Arguing as above it suffices to show that the kernel of $G'$ is zero.
So let $\mathcal{M} = (M_n)$ be a good sheaf of differential graded
modules over $\mathcal{B}$ which represents an object of
$\mathit{QC}(\mathcal{B})$ in the kernel of $G'$. Then
$$
0 = R\lim M_n \Rightarrow
0 = (R\lim M_n) \otimes_R^\mathbf{L} B_t =
R\lim (M_n \otimes_R^\mathbf{L} B_t)
$$
By Lemma \ref{lemma-different-tensors} we have
$R\lim (M_n \otimes_R^\mathbf{L} B_t) =
R\lim (M_n \otimes_{B_n}^\mathbf{L} B_t)$.
Since $(M_n)$ is an object of $\mathit{QC}(\mathcal{B})$ we
see that the inverse system $M_n \otimes_{B_n}^\mathbf{L} B_t$
is eventually constant with value $M_t$. Hence $M_t = 0$ as desired.
\end{proof}

\begin{remark}
\label{remark-proregular}
Let $R$ be a ring and let $f_1, \ldots, f_r \in R$ be a sequence of elements
generating an ideal $I$. Let $K_n$ be the Koszul complex on
$f_1^n, \ldots, f_r^n$ viewed as a differential graded $R$-algebra.
We say $f_1, \ldots, f_r$ is a {\it weakly proregular sequence}
if for all $n$ there is an $m > n$ such that $K_m \to K_n$
induces the zero map on cohomology except in degree $0$. If so, then
the arguments in the proof of Proposition \ref{proposition-derived-complete}
continue to work even when $R$ is not Noetherian.
In particular we see that $\mathit{QC}(\{R/I^n\})$
is equivalent as an $R$-linear triangulated category
to the category $D_{comp}(R, I)$ of derived complete objects, provided
$I$ can be generated by a weakly proregular sequence.
If the need arises, we will precisely state and prove this here.
\end{remark}








\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
